Commit a236b5d1 authored by zhujiashun's avatar zhujiashun

health_check_using_rpc: refine doc and comment

parent e38afc88
...@@ -242,7 +242,7 @@ locality-aware,优先选择延时低的下游,直到其延时高于其他机 ...@@ -242,7 +242,7 @@ locality-aware,优先选择延时低的下游,直到其延时高于其他机
| ------------------------- | ----- | ---------------------------------------- | ----------------------- | | ------------------------- | ----- | ---------------------------------------- | ----------------------- |
| health_check_interval (R) | 3 | seconds between consecutive health-checkings | src/brpc/socket_map.cpp | | 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也会停止连接尝试。
# 发起访问 # 发起访问
......
...@@ -99,7 +99,7 @@ DEFINE_bool(health_check_using_rpc, false, "By default health check succeeds if ...@@ -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" "when server can be connected but also an additional http call succeeds"
"indicated by FLAGS_health_check_path and FLAGS_health_check_timeout_ms"); "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_string(health_check_path, "/health", "Http path of health check call");
DEFINE_int32(health_check_timeout_ms, 300, "Timeout of health check call"); DEFINE_int32(health_check_timeout_ms, 500, "Timeout of health check call");
static bool validate_connect_timeout_as_unreachable(const char*, int32_t v) { static bool validate_connect_timeout_as_unreachable(const char*, int32_t v) {
return v >= 2 && v < 1000/*large enough*/; return v >= 2 && v < 1000/*large enough*/;
...@@ -2243,8 +2243,9 @@ void Socket::DebugSocket(std::ostream& os, SocketId id) { ...@@ -2243,8 +2243,9 @@ void Socket::DebugSocket(std::ostream& os, SocketId id) {
<< "\nauth_id=" << ptr->_auth_id.value << "\nauth_id=" << ptr->_auth_id.value
<< "\nauth_context=" << ptr->_auth_context << "\nauth_context=" << ptr->_auth_context
<< "\nlogoff_flag=" << ptr->_logoff_flag.load(butil::memory_order_relaxed) << "\nlogoff_flag=" << ptr->_logoff_flag.load(butil::memory_order_relaxed)
// TODO(zhujiashun): add _health_checking_using_rpc
<< "\nrecycle_flag=" << ptr->_recycle_flag.load(butil::memory_order_relaxed) << "\nrecycle_flag=" << ptr->_recycle_flag.load(butil::memory_order_relaxed)
<< "\nhealth_checking_using_rpc="
<< ptr->_health_checking_using_rpc.load(butil::memory_order_relaxed)
<< "\nagent_socket_id="; << "\nagent_socket_id=";
const SocketId asid = ptr->_agent_socket_id.load(butil::memory_order_relaxed); const SocketId asid = ptr->_agent_socket_id.load(butil::memory_order_relaxed);
if (asid != INVALID_SOCKET_ID) { if (asid != INVALID_SOCKET_ID) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment