Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make interconnect proxy retry timeout parameters configurable (merge from main #3748) #5783

Merged
merged 1 commit into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions ydb/core/driver_lib/run/kikimr_services_initializers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,16 @@ static TInterconnectSettings GetInterconnectSettings(const NKikimrConfig::TInter
}
result.SocketBacklogSize = config.GetSocketBacklogSize();

if (config.HasFirstErrorSleep()) {
result.FirstErrorSleep = DurationFromProto(config.GetFirstErrorSleep());
}
if (config.HasMaxErrorSleep()) {
result.MaxErrorSleep = DurationFromProto(config.GetMaxErrorSleep());
}
if (config.HasErrorSleepRetryMultiplier()) {
result.ErrorSleepRetryMultiplier = config.GetErrorSleepRetryMultiplier();
}

return result;
}

Expand Down
4 changes: 4 additions & 0 deletions ydb/core/protos/config.proto
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,10 @@ message TInterconnectConfig {
optional NKikimrConfigUnits.TDuration LostConnectionDuration = 28;
optional NKikimrConfigUnits.TDuration BatchPeriodDuration = 29;

optional NKikimrConfigUnits.TDuration FirstErrorSleep = 46;
optional NKikimrConfigUnits.TDuration MaxErrorSleep = 47;
optional double ErrorSleepRetryMultiplier = 48;

optional uint32 OutgoingHandshakeInflightLimit = 43;
}

Expand Down
3 changes: 3 additions & 0 deletions ydb/library/actors/interconnect/interconnect_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ namespace NActors {
bool EnableExternalDataChannel = false;
bool ValidateIncomingPeerViaDirectLookup = false;
ui32 SocketBacklogSize = 0; // SOMAXCONN if zero
TDuration FirstErrorSleep = TDuration::MilliSeconds(10);
TDuration MaxErrorSleep = TDuration::Seconds(1);
double ErrorSleepRetryMultiplier = 4.0;

ui32 GetSendBufferSize() const {
ui32 res = 512 * 1024; // 512 kb is the default value for send buffer
Expand Down
9 changes: 3 additions & 6 deletions ydb/library/actors/interconnect/interconnect_tcp_proxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@
namespace NActors {
static constexpr TDuration GetNodeRequestTimeout = TDuration::Seconds(5);

static constexpr TDuration FirstErrorSleep = TDuration::MilliSeconds(10);
static constexpr TDuration MaxErrorSleep = TDuration::Seconds(10);
static constexpr ui32 SleepRetryMultiplier = 4;

static TString PeerNameForHuman(ui32 nodeNum, const TString& longName, ui16 port) {
TStringBuf token;
TStringBuf(longName).NextTok('.', token);
Expand Down Expand Up @@ -758,9 +754,10 @@ namespace NActors {

// recalculate wakeup timeout -- if this is the first failure, then we sleep for default timeout; otherwise we
// sleep N times longer than the previous try, but not longer than desired number of seconds
auto& s = Common->Settings;
HoldByErrorWakeupDuration = HoldByErrorWakeupDuration != TDuration::Zero()
? Min(HoldByErrorWakeupDuration * SleepRetryMultiplier, MaxErrorSleep)
: FirstErrorSleep;
? Min(HoldByErrorWakeupDuration * s.ErrorSleepRetryMultiplier, s.MaxErrorSleep)
: Common->Settings.FirstErrorSleep;

// transit to required state and arm wakeup timer
if (Terminated) {
Expand Down
Loading