Skip to content

Commit

Permalink
Make interconnect proxy retry timeout parameters configurable (merge …
Browse files Browse the repository at this point in the history
…from main #3748) (#5783)
  • Loading branch information
alexvru authored Jun 20, 2024
1 parent a355430 commit 49e8858
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 6 deletions.
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

0 comments on commit 49e8858

Please sign in to comment.