Skip to content

Commit bf444b8

Browse files
authored
Make interconnect proxy retry timeout parameters configurable (#3748)
1 parent d7ca23d commit bf444b8

File tree

4 files changed

+20
-6
lines changed

4 files changed

+20
-6
lines changed

ydb/core/driver_lib/run/kikimr_services_initializers.cpp

+10
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,16 @@ static TInterconnectSettings GetInterconnectSettings(const NKikimrConfig::TInter
538538
}
539539
result.SocketBacklogSize = config.GetSocketBacklogSize();
540540

541+
if (config.HasFirstErrorSleep()) {
542+
result.FirstErrorSleep = DurationFromProto(config.GetFirstErrorSleep());
543+
}
544+
if (config.HasMaxErrorSleep()) {
545+
result.MaxErrorSleep = DurationFromProto(config.GetMaxErrorSleep());
546+
}
547+
if (config.HasErrorSleepRetryMultiplier()) {
548+
result.ErrorSleepRetryMultiplier = config.GetErrorSleepRetryMultiplier();
549+
}
550+
541551
return result;
542552
}
543553

ydb/core/protos/config.proto

+4
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,10 @@ message TInterconnectConfig {
423423
optional NKikimrConfigUnits.TDuration LostConnectionDuration = 28;
424424
optional NKikimrConfigUnits.TDuration BatchPeriodDuration = 29;
425425

426+
optional NKikimrConfigUnits.TDuration FirstErrorSleep = 46;
427+
optional NKikimrConfigUnits.TDuration MaxErrorSleep = 47;
428+
optional double ErrorSleepRetryMultiplier = 48;
429+
426430
optional uint32 OutgoingHandshakeInflightLimit = 43;
427431
}
428432

ydb/library/actors/interconnect/interconnect_common.h

+3
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ namespace NActors {
5151
bool EnableExternalDataChannel = false;
5252
bool ValidateIncomingPeerViaDirectLookup = false;
5353
ui32 SocketBacklogSize = 0; // SOMAXCONN if zero
54+
TDuration FirstErrorSleep = TDuration::MilliSeconds(10);
55+
TDuration MaxErrorSleep = TDuration::Seconds(1);
56+
double ErrorSleepRetryMultiplier = 4.0;
5457

5558
ui32 GetSendBufferSize() const {
5659
ui32 res = 512 * 1024; // 512 kb is the default value for send buffer

ydb/library/actors/interconnect/interconnect_tcp_proxy.cpp

+3-6
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@
99
namespace NActors {
1010
static constexpr TDuration GetNodeRequestTimeout = TDuration::Seconds(5);
1111

12-
static constexpr TDuration FirstErrorSleep = TDuration::MilliSeconds(10);
13-
static constexpr TDuration MaxErrorSleep = TDuration::Seconds(10);
14-
static constexpr ui32 SleepRetryMultiplier = 4;
15-
1612
static TString PeerNameForHuman(ui32 nodeNum, const TString& longName, ui16 port) {
1713
TStringBuf token;
1814
TStringBuf(longName).NextTok('.', token);
@@ -763,9 +759,10 @@ namespace NActors {
763759

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

770767
// transit to required state and arm wakeup timer
771768
if (Terminated) {

0 commit comments

Comments
 (0)