summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoralexvru <[email protected]>2023-06-27 12:21:23 +0300
committeralexvru <[email protected]>2023-06-27 12:21:23 +0300
commit60b31269dc93b86d297c964565c892a92a34396a (patch)
treedee243f78c26ddb25bc72c9c3814a8d9f68707a7
parent86e59d4bc6858a17a13ea13fc55c729ae3615f1f (diff)
Tunable backlog size for IC
-rw-r--r--library/cpp/actors/interconnect/interconnect_common.h1
-rw-r--r--library/cpp/actors/interconnect/interconnect_tcp_server.cpp3
-rw-r--r--ydb/core/driver_lib/run/kikimr_services_initializers.cpp1
-rw-r--r--ydb/core/protos/config.proto1
4 files changed, 5 insertions, 1 deletions
diff --git a/library/cpp/actors/interconnect/interconnect_common.h b/library/cpp/actors/interconnect/interconnect_common.h
index aa2cbe9a191..d3130380943 100644
--- a/library/cpp/actors/interconnect/interconnect_common.h
+++ b/library/cpp/actors/interconnect/interconnect_common.h
@@ -50,6 +50,7 @@ namespace NActors {
ui32 NumPreallocatedBuffers = 16;
bool EnableExternalDataChannel = false;
bool ValidateIncomingPeerViaDirectLookup = false;
+ ui32 SocketBacklogSize = 0; // SOMAXCONN if zero
ui32 GetSendBufferSize() const {
ui32 res = 512 * 1024; // 512 kb is the default value for send buffer
diff --git a/library/cpp/actors/interconnect/interconnect_tcp_server.cpp b/library/cpp/actors/interconnect/interconnect_tcp_server.cpp
index aad8677ca46..ede35b0b8b0 100644
--- a/library/cpp/actors/interconnect/interconnect_tcp_server.cpp
+++ b/library/cpp/actors/interconnect/interconnect_tcp_server.cpp
@@ -46,9 +46,10 @@ namespace NActors {
if (addr.GetFamily() == AF_INET6) {
SetSockOpt(*Listener, IPPROTO_IPV6, IPV6_V6ONLY, 0);
}
+ const ui32 backlog = ProxyCommonCtx->Settings.SocketBacklogSize;
if (const auto e = -Listener->Bind(addr)) {
return e;
- } else if (const auto e = -Listener->Listen(SOMAXCONN)) {
+ } else if (const auto e = -Listener->Listen(backlog ? backlog : SOMAXCONN)) {
return e;
} else {
return 0;
diff --git a/ydb/core/driver_lib/run/kikimr_services_initializers.cpp b/ydb/core/driver_lib/run/kikimr_services_initializers.cpp
index 24672d25aeb..51eba3cae4d 100644
--- a/ydb/core/driver_lib/run/kikimr_services_initializers.cpp
+++ b/ydb/core/driver_lib/run/kikimr_services_initializers.cpp
@@ -578,6 +578,7 @@ static TInterconnectSettings GetInterconnectSettings(const NKikimrConfig::TInter
if (config.HasValidateIncomingPeerViaDirectLookup()) {
result.ValidateIncomingPeerViaDirectLookup = config.GetValidateIncomingPeerViaDirectLookup();
}
+ result.SocketBacklogSize = config.GetSocketBacklogSize();
return result;
}
diff --git a/ydb/core/protos/config.proto b/ydb/core/protos/config.proto
index aedc48a26fc..807bd4fc7ab 100644
--- a/ydb/core/protos/config.proto
+++ b/ydb/core/protos/config.proto
@@ -440,6 +440,7 @@ message TInterconnectConfig {
optional uint32 NumPreallocatedBuffers = 41;
optional bool EnableExternalDataChannel = 42;
optional bool ValidateIncomingPeerViaDirectLookup = 44;
+ optional uint32 SocketBacklogSize = 45; // SOMAXCONN if not set or zero
// ballast is added to IC handshake frames to ensure correctness of jumbo frames transmission over network
optional uint32 HandshakeBallastSize = 14;