Skip to content

Commit

Permalink
branch-3.0: [improve](cloud) adjust timeout settings for BE brpc conn…
Browse files Browse the repository at this point in the history
…ection pool to meta-service #44374 (#44578)

Cherry-picked from #44374

Co-authored-by: Luwei <[email protected]>
  • Loading branch information
github-actions[bot] and luwei16 authored Nov 29, 2024
1 parent 61595df commit 8e9eb1c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions be/src/cloud/cloud_meta_mgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,12 +243,12 @@ class MetaServiceProxy {
long deadline = now;
// connection age only works without list endpoint.
if (!is_meta_service_endpoint_list &&
config::meta_service_connection_age_base_minutes > 0) {
config::meta_service_connection_age_base_seconds > 0) {
std::default_random_engine rng(static_cast<uint32_t>(now));
std::uniform_int_distribution<> uni(
config::meta_service_connection_age_base_minutes,
config::meta_service_connection_age_base_minutes * 2);
deadline = now + duration_cast<milliseconds>(minutes(uni(rng))).count();
config::meta_service_connection_age_base_seconds,
config::meta_service_connection_age_base_seconds * 2);
deadline = now + duration_cast<milliseconds>(seconds(uni(rng))).count();
} else {
deadline = LONG_MAX;
}
Expand Down
2 changes: 1 addition & 1 deletion be/src/cloud/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ DEFINE_Bool(meta_service_use_load_balancer, "false");
DEFINE_mInt32(meta_service_rpc_timeout_ms, "10000");
DEFINE_Bool(meta_service_connection_pooled, "true");
DEFINE_mInt64(meta_service_connection_pool_size, "20");
DEFINE_mInt32(meta_service_connection_age_base_minutes, "5");
DEFINE_mInt32(meta_service_connection_age_base_seconds, "30");
DEFINE_mInt32(meta_service_idle_connection_timeout_ms, "0");
DEFINE_mInt32(meta_service_rpc_retry_times, "200");
DEFINE_mInt32(meta_service_brpc_timeout_ms, "10000");
Expand Down
4 changes: 2 additions & 2 deletions be/src/cloud/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ static inline bool is_cloud_mode() {
// If meta services are deployed behind a load balancer, set this config to "host:port" of the load balancer.
// Here is a set of configs to configure the connection behaviors:
// - meta_service_connection_pooled: distribute the long connections to different RS of the VIP.
// - meta_service_connection_age_base_minutes: expire the connection after a random time during [base, 2*base],
// - meta_service_connection_age_base_seconds: expire the connection after a random time during [base, 2*base],
// so that the BE has a chance to connect to a new RS. (When you add a new RS, the BE will connect to it)
// - meta_service_idle_connection_timeout_ms: rebuild the idle connections after the timeout exceeds. Some LB
// vendors will reset the connection if it is idle for a long time.
Expand All @@ -50,7 +50,7 @@ DECLARE_mInt64(meta_service_connection_pool_size);
// has a chance to connect to a new RS. Set zero to disable it.
//
// Only works when meta_service_endpoint is set to a single host.
DECLARE_mInt32(meta_service_connection_age_base_minutes);
DECLARE_mInt32(meta_service_connection_age_base_seconds);
// Rebuild the idle connections after the timeout exceeds. Set zero to disable it.
//
// Only works when meta_service_endpoint is set to a single host.
Expand Down

0 comments on commit 8e9eb1c

Please sign in to comment.