Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
B
brpc
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
brpc
Commits
a236b5d1
Commit
a236b5d1
authored
Mar 20, 2019
by
zhujiashun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
health_check_using_rpc: refine doc and comment
parent
e38afc88
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
3 deletions
+4
-3
client.md
docs/cn/client.md
+1
-1
socket.cpp
src/brpc/socket.cpp
+3
-2
No files found.
docs/cn/client.md
View file @
a236b5d1
...
...
@@ -242,7 +242,7 @@ locality-aware,优先选择延时低的下游,直到其延时高于其他机
| ------------------------- | ----- | ---------------------------------------- | ----------------------- |
| health_check_interval (R) | 3 | seconds between consecutive health-checkings | src/brpc/socket_map.cpp |
在默认的配置下,一旦server被连接上,它会恢复为可用状态;brpc还提供了应用层健康检查的机制,协议是Http,只有当Server返回200时,这个server才算恢复,可以通过-health
\_
check
\_
using
\_
rpc=true来打开这个功能,-health
\_
check
\_
path设置访问的路径(默认访问brpc自带的/health接口),-health
\_
check
\_
timeout
\_
ms设置
访问超时
。当一个连接断开时,只有如果在隔离过程中,server从命名服务中删除了,brpc也会停止连接尝试。
在默认的配置下,一旦server被连接上,它会恢复为可用状态;brpc还提供了应用层健康检查的机制,协议是Http,只有当Server返回200时,这个server才算恢复,可以通过-health
\_
check
\_
using
\_
rpc=true来打开这个功能,-health
\_
check
\_
path设置访问的路径(默认访问brpc自带的/health接口),-health
\_
check
\_
timeout
\_
ms设置
超时(默认500ms)
。当一个连接断开时,只有如果在隔离过程中,server从命名服务中删除了,brpc也会停止连接尝试。
# 发起访问
...
...
src/brpc/socket.cpp
View file @
a236b5d1
...
...
@@ -99,7 +99,7 @@ DEFINE_bool(health_check_using_rpc, false, "By default health check succeeds if
"when server can be connected but also an additional http call succeeds"
"indicated by FLAGS_health_check_path and FLAGS_health_check_timeout_ms"
);
DEFINE_string
(
health_check_path
,
"/health"
,
"Http path of health check call"
);
DEFINE_int32
(
health_check_timeout_ms
,
3
00
,
"Timeout of health check call"
);
DEFINE_int32
(
health_check_timeout_ms
,
5
00
,
"Timeout of health check call"
);
static
bool
validate_connect_timeout_as_unreachable
(
const
char
*
,
int32_t
v
)
{
return
v
>=
2
&&
v
<
1000
/*large enough*/
;
...
...
@@ -2243,8 +2243,9 @@ void Socket::DebugSocket(std::ostream& os, SocketId id) {
<<
"
\n
auth_id="
<<
ptr
->
_auth_id
.
value
<<
"
\n
auth_context="
<<
ptr
->
_auth_context
<<
"
\n
logoff_flag="
<<
ptr
->
_logoff_flag
.
load
(
butil
::
memory_order_relaxed
)
// TODO(zhujiashun): add _health_checking_using_rpc
<<
"
\n
recycle_flag="
<<
ptr
->
_recycle_flag
.
load
(
butil
::
memory_order_relaxed
)
<<
"
\n
health_checking_using_rpc="
<<
ptr
->
_health_checking_using_rpc
.
load
(
butil
::
memory_order_relaxed
)
<<
"
\n
agent_socket_id="
;
const
SocketId
asid
=
ptr
->
_agent_socket_id
.
load
(
butil
::
memory_order_relaxed
);
if
(
asid
!=
INVALID_SOCKET_ID
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment