Skip to content

Commit 1ade07e

Browse files
committed
[ICRDMA] Add RDMA configuration into YDB config. EXT-1506 (#28843)
1 parent 6c9b104 commit 1ade07e

File tree

7 files changed

+37
-3
lines changed

7 files changed

+37
-3
lines changed

ydb/core/client/server/msgbus_server_ic_debug.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ class TInterconnectDebugActor : public TMessageBusSecureRequest<TMessageBusServe
6767
params.SoftLoad = record.GetSoftLoad();
6868
params.Duration = TDuration::MicroSeconds(record.GetDuration());
6969
params.UseProtobufWithPayload = record.GetUseProtobufWithPayload();
70+
params.RdmaMode = record.GetRdmaMode();
7071
Callback = [=](const TActorContext& ctx) {
7172
ui32 poolId = 0;
7273
if (record.HasServicePool()) {

ydb/core/driver_lib/cli_utils/cli_cmds_debug.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ class TInterconnectLoad : public TClientCommand {
1818
TDuration Duration;
1919
bool UseProtobufWithPayload = false;
2020
TString ServicePool;
21+
ui32 RdmaMode = 0;
2122

2223
public:
2324
TInterconnectLoad()
@@ -83,6 +84,10 @@ class TInterconnectLoad : public TClientCommand {
8384
config.Opts->AddLongOption("service-pool", "service pool name")
8485
.RequiredArgument()
8586
.StoreResult(&ServicePool);
87+
88+
config.Opts->AddLongOption("rdma-mode", "rdma mode for data transfer (0 - disabled; 1 - use rdma)")
89+
.RequiredArgument()
90+
.StoreResult(&RdmaMode);
8691
}
8792

8893
int Run(TConfig& config) override {
@@ -110,6 +115,10 @@ class TInterconnectLoad : public TClientCommand {
110115
request.SetServicePool(ServicePool);
111116
}
112117

118+
if (RdmaMode) {
119+
request.SetRdmaMode(RdmaMode);
120+
}
121+
113122
auto callback = [](const NMsgBusProxy::TBusResponse& response) {
114123
return response.Record.GetStatus() == NMsgBusProxy::MSTATUS_OK ? 0 : 1;
115124
};

ydb/core/driver_lib/run/kikimr_services_initializers.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,8 @@
235235
#include <ydb/library/actors/interconnect/load.h>
236236
#include <ydb/library/actors/interconnect/poller/poller_actor.h>
237237
#include <ydb/library/actors/interconnect/poller/poller_tcp.h>
238+
#include <ydb/library/actors/interconnect/rdma/cq_actor/cq_actor.h>
239+
#include <ydb/library/actors/interconnect/rdma/mem_pool.h>
238240
#include <ydb/library/actors/util/affinity.h>
239241
#include <ydb/library/actors/wilson/wilson_uploader.h>
240242
#include <ydb/library/slide_limiter/service/service.h>
@@ -503,6 +505,10 @@ static TInterconnectSettings GetInterconnectSettings(const NKikimrConfig::TInter
503505
}
504506
}
505507

508+
if (config.HasRdmaChecksum()) {
509+
result.RdmaChecksum = config.GetRdmaChecksum();
510+
}
511+
506512
return result;
507513
}
508514

@@ -626,6 +632,17 @@ void TBasicServicesInitializer::InitializeServices(NActors::TActorSystemSetup* s
626632

627633
TIntrusivePtr<TInterconnectProxyCommon> icCommon;
628634
icCommon.Reset(new TInterconnectProxyCommon);
635+
636+
if (icConfig.GetUseRdma()) {
637+
setup->LocalServices.emplace_back(NInterconnect::NRdma::MakeCqActorId(),
638+
TActorSetupCmd(NInterconnect::NRdma::CreateCqActor(-1, icConfig.GetRdmaMaxWr()), TMailboxType::ReadAsFilled, interconnectPoolId));
639+
640+
// Interconnect uses rdma mem pool directly
641+
const auto counters = GetServiceCounters(appData->Counters, "utils");
642+
icCommon->RdmaMemPool = NInterconnect::NRdma::CreateSlotMemPool(counters.Get());
643+
// Clients via wrapper to handle allocation fail
644+
setup->RcBufAllocator = std::make_shared<TRdmaAllocatorWithFallback>(icCommon->RdmaMemPool);
645+
}
629646
icCommon->NameserviceId = nameserviceId;
630647
icCommon->MonCounters = GetServiceCounters(counters, "interconnect");
631648
icCommon->ChannelsConfig = channels;

ydb/core/protos/config.proto

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,9 @@ message TInterconnectConfig {
476476
optional bool ValidateIncomingPeerViaDirectLookup = 44;
477477
optional uint32 SocketBacklogSize = 45; // SOMAXCONN if not set or zero
478478
optional ESocketSendOptimization SocketSendOptimization = 51 [default = IC_SO_DISABLED];
479+
optional bool UseRdma = 52;
480+
optional uint32 RdmaMaxWr = 53 [default = 4096];
481+
optional bool RdmaChecksum = 54 [default = true];
479482

480483
// ballast is added to IC handshake frames to ensure correctness of jumbo frames transmission over network
481484
optional uint32 HandshakeBallastSize = 14;

ydb/core/protos/msgbus.proto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -648,6 +648,7 @@ message TInterconnectDebug {
648648
optional uint64 RescheduleMax = 205;
649649

650650
optional string SecurityToken = 13 [(Ydb.sensitive) = true];
651+
optional uint32 RdmaMode = 14;
651652
}
652653

653654
message TConsoleRequest {

ydb/library/actors/interconnect/load.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,9 +197,11 @@ namespace NInterconnect {
197197
// create message and send it to the first hop
198198
THolder<TEvLoadMessage> ev;
199199
if (Params.UseProtobufWithPayload && size) {
200-
auto buffer = TRopeAlignedBuffer::Allocate(size);
201-
memset(buffer->GetBuffer(), '*', size);
202-
ev.Reset(new TEvLoadMessage(Hops, id, TRope(buffer)));
200+
TRcBuf buffer = Params.RdmaMode
201+
? ctx.ActorSystem()->GetRcBufAllocator()->AllocRcBuf(size, 0, 0)
202+
: TRcBuf(TRopeAlignedBuffer::Allocate(size));
203+
memset(buffer.GetDataMut(), '*', size);
204+
ev.Reset(new TEvLoadMessage(Hops, id, TRope(std::move(buffer))));
203205
} else {
204206
TString payload;
205207
if (size) {

ydb/library/actors/interconnect/load.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ namespace NInterconnect {
1818
bool SoftLoad; // is the load soft?
1919
TDuration Duration; // test duration
2020
bool UseProtobufWithPayload; // store payload separately
21+
ui32 RdmaMode; // rdma params bitmap, 0 - not used
2122
};
2223
NActors::IActor* CreateLoadActor(const TLoadParams& params);
2324

0 commit comments

Comments
 (0)