Skip to content

Commit 550ba0c

Browse files
committed
Separate acceleration ICB settings for HDD and SSD (#11590)
1 parent 42d4c23 commit 550ba0c

20 files changed

+209
-81
lines changed

ydb/core/blobstorage/common/defs.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#pragma once
2+
3+
#include <ydb/core/blobstorage/defs.h>
4+
#include <util/datetime/base.h>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#include "immediate_control_defaults.h"
2+
3+
namespace NKikimr {
4+
5+
TControlWrapper SlowDiskThresholdDefaultControl =
6+
TControlWrapper(std::round(DefaultSlowDiskThreshold * 1000), 1, 1'000'000);
7+
8+
TControlWrapper PredictedDelayMultiplierDefaultControl =
9+
TControlWrapper(std::round(DefaultPredictedDelayMultiplier * 1000), 0, 1'000'000);
10+
11+
TControlWrapper MaxNumOfSlowDisksDefaultControl =
12+
TControlWrapper(DefaultMaxNumOfSlowDisks, 1, 2);
13+
14+
} // namespace NKikimr
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#pragma once
2+
3+
#include "defs.h"
4+
#include <ydb/core/control/immediate_control_board_wrapper.h>
5+
6+
namespace NKikimr {
7+
8+
constexpr bool DefaultEnablePutBatching = true;
9+
constexpr bool DefaultEnableVPatch = false;
10+
11+
constexpr float DefaultSlowDiskThreshold = 2;
12+
constexpr float DefaultPredictedDelayMultiplier = 1;
13+
constexpr ui32 DefaultMaxNumOfSlowDisks = 2;
14+
15+
extern TControlWrapper SlowDiskThresholdDefaultControl;
16+
extern TControlWrapper PredictedDelayMultiplierDefaultControl;
17+
extern TControlWrapper MaxNumOfSlowDisksDefaultControl;
18+
}

ydb/core/blobstorage/common/ya.make

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
LIBRARY()
2+
3+
PEERDIR(
4+
ydb/core/base
5+
)
6+
7+
SRCS(
8+
immediate_control_defaults.cpp
9+
)
10+
11+
END()

ydb/core/blobstorage/dsproxy/dsproxy.h

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <ydb/core/blobstorage/base/blobstorage_events.h>
1515
#include <ydb/core/blobstorage/base/transparent.h>
1616
#include <ydb/core/blobstorage/backpressure/queue_backpressure_client.h>
17+
#include <ydb/core/blobstorage/common/immediate_control_defaults.h>
1718
#include <ydb/library/actors/core/interconnect.h>
1819
#include <ydb/library/actors/wilson/wilson_span.h>
1920
#include <ydb/core/base/appdata.h>
@@ -52,13 +53,6 @@ const ui32 MaxRequestSize = 1000;
5253

5354
const ui32 MaskSizeBits = 32;
5455

55-
constexpr bool DefaultEnablePutBatching = true;
56-
constexpr bool DefaultEnableVPatch = false;
57-
58-
constexpr double DefaultSlowDiskThreshold = 2;
59-
constexpr double DefaultPredictedDelayMultiplier = 1;
60-
constexpr ui32 DefaultMaxNumOfSlowDisks = 2;
61-
6256
constexpr bool WithMovingPatchRequestToStaticNode = true;
6357

6458
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -846,14 +840,28 @@ IActor* CreateBlobStorageGroupAssimilateRequest(TBlobStorageGroupAssimilateParam
846840

847841
IActor* CreateBlobStorageGroupEjectedProxy(ui32 groupId, TIntrusivePtr<TDsProxyNodeMon> &nodeMon);
848842

843+
struct TBlobStorageProxyControlWrappers {
844+
TMemorizableControlWrapper EnablePutBatching;
845+
TMemorizableControlWrapper EnableVPatch;
846+
847+
#define DEVICE_TYPE_SEPECIFIC_MEMORIZABLE_CONTROLS(prefix) \
848+
TMemorizableControlWrapper prefix = prefix##DefaultControl; \
849+
TMemorizableControlWrapper prefix##HDD = prefix##DefaultControl; \
850+
TMemorizableControlWrapper prefix##SSD = prefix##DefaultControl
851+
852+
// Acceleration parameters
853+
DEVICE_TYPE_SEPECIFIC_MEMORIZABLE_CONTROLS(SlowDiskThreshold);
854+
DEVICE_TYPE_SEPECIFIC_MEMORIZABLE_CONTROLS(PredictedDelayMultiplier);
855+
DEVICE_TYPE_SEPECIFIC_MEMORIZABLE_CONTROLS(MaxNumOfSlowDisks);
856+
857+
#undef DEVICE_TYPE_SEPECIFIC_MEMORIZABLE_CONTROLS
858+
859+
};
860+
849861
struct TBlobStorageProxyParameters {
850862
bool UseActorSystemTimeInBSQueue = false;
851863

852-
const TControlWrapper& EnablePutBatching;
853-
const TControlWrapper& EnableVPatch;
854-
const TControlWrapper& SlowDiskThreshold;
855-
const TControlWrapper& PredictedDelayMultiplier;
856-
const TControlWrapper& MaxNumOfSlowDisks = TControlWrapper(DefaultMaxNumOfSlowDisks, 1, 2);
864+
TBlobStorageProxyControlWrappers Controls;
857865
};
858866

859867
IActor* CreateBlobStorageGroupProxyConfigured(TIntrusivePtr<TBlobStorageGroupInfo>&& info,

ydb/core/blobstorage/dsproxy/dsproxy_impl.cpp

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,7 @@ namespace NKikimr {
1515
, IsEjected(false)
1616
, ForceWaitAllDrives(forceWaitAllDrives)
1717
, UseActorSystemTimeInBSQueue(params.UseActorSystemTimeInBSQueue)
18-
, EnablePutBatching(params.EnablePutBatching)
19-
, EnableVPatch(params.EnableVPatch)
20-
, SlowDiskThreshold(params.SlowDiskThreshold)
21-
, PredictedDelayMultiplier(params.PredictedDelayMultiplier)
22-
, MaxNumOfSlowDisks(params.MaxNumOfSlowDisks)
18+
, Controls(std::move(params.Controls))
2319
{}
2420

2521
TBlobStorageGroupProxy::TBlobStorageGroupProxy(ui32 groupId, bool isEjected,TIntrusivePtr<TDsProxyNodeMon> &nodeMon,
@@ -29,20 +25,16 @@ namespace NKikimr {
2925
, IsEjected(isEjected)
3026
, ForceWaitAllDrives(false)
3127
, UseActorSystemTimeInBSQueue(params.UseActorSystemTimeInBSQueue)
32-
, EnablePutBatching(params.EnablePutBatching)
33-
, EnableVPatch(params.EnableVPatch)
34-
, SlowDiskThreshold(params.SlowDiskThreshold)
35-
, PredictedDelayMultiplier(params.PredictedDelayMultiplier)
36-
, MaxNumOfSlowDisks(params.MaxNumOfSlowDisks)
28+
, Controls(std::move(params.Controls))
3729
{}
3830

3931
IActor* CreateBlobStorageGroupEjectedProxy(ui32 groupId, TIntrusivePtr<TDsProxyNodeMon> &nodeMon) {
4032
return new TBlobStorageGroupProxy(groupId, true, nodeMon,
4133
TBlobStorageProxyParameters{
42-
.EnablePutBatching = TControlWrapper(false, false, true),
43-
.EnableVPatch = TControlWrapper(false, false, true),
44-
.SlowDiskThreshold = TControlWrapper(2000, 1, 1000000),
45-
.PredictedDelayMultiplier = TControlWrapper(1000, 1, 1000000),
34+
.Controls = TBlobStorageProxyControlWrappers{
35+
.EnablePutBatching = TControlWrapper(false, false, true),
36+
.EnableVPatch = TControlWrapper(false, false, true),
37+
}
4638
}
4739
);
4840
}

ydb/core/blobstorage/dsproxy/dsproxy_impl.h

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,6 @@ class TBlobStorageGroupProxy : public TActorBootstrapped<TBlobStorageGroupProxy>
106106
TBatchedQueue<TEvBlobStorage::TEvGet::TPtr> BatchedGets[GetHandleClassCount];
107107
TStackVec<NKikimrBlobStorage::EGetHandleClass, GetHandleClassCount> GetBatchedBucketQueue;
108108

109-
TMemorizableControlWrapper EnablePutBatching;
110-
TMemorizableControlWrapper EnableVPatch;
111-
112109
TInstant EstablishingSessionStartTime;
113110

114111
const TDuration MuteDuration = TDuration::Seconds(5);
@@ -119,10 +116,7 @@ class TBlobStorageGroupProxy : public TActorBootstrapped<TBlobStorageGroupProxy>
119116
bool HasInvalidGroupId() const { return GroupId.GetRawId() == Max<ui32>(); }
120117
void ProcessInitQueue();
121118

122-
// Acceleration parameters
123-
TMemorizableControlWrapper SlowDiskThreshold;
124-
TMemorizableControlWrapper PredictedDelayMultiplier;
125-
TMemorizableControlWrapper MaxNumOfSlowDisks;
119+
TBlobStorageProxyControlWrappers Controls;
126120

127121
TAccelerationParams GetAccelerationParams();
128122

ydb/core/blobstorage/dsproxy/dsproxy_request.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,10 @@ namespace NKikimr {
180180
Y_DEBUG_ABORT_UNLESS(MinREALHugeBlobInBytes);
181181
const ui32 partSize = Info->Type.PartSize(ev->Get()->Id);
182182

183-
if (EnablePutBatching && partSize < MinREALHugeBlobInBytes && partSize <= MaxBatchedPutSize) {
183+
TInstant now = TActivationContext::Now();
184+
185+
if (Controls.EnablePutBatching.Update(now) && partSize < MinREALHugeBlobInBytes &&
186+
partSize <= MaxBatchedPutSize) {
184187
NKikimrBlobStorage::EPutHandleClass handleClass = ev->Get()->HandleClass;
185188
TEvBlobStorage::TEvPut::ETactic tactic = ev->Get()->Tactic;
186189
Y_ABORT_UNLESS((ui64)handleClass <= PutHandleClassCount);
@@ -278,7 +281,7 @@ namespace NKikimr {
278281
.Event = ev->Get(),
279282
.ExecutionRelay = ev->Get()->ExecutionRelay
280283
},
281-
.UseVPatch = static_cast<bool>(EnableVPatch.Update(now))
284+
.UseVPatch = static_cast<bool>(Controls.EnableVPatch.Update(now))
282285
}),
283286
ev->Get()->Deadline
284287
);
@@ -554,7 +557,7 @@ namespace NKikimr {
554557
++*Mon->EventStopPutBatching;
555558
LWPROBE(DSProxyBatchedPutRequest, BatchedPutRequestCount, GroupId.GetRawId());
556559
BatchedPutRequestCount = 0;
557-
EnablePutBatching.Update(TActivationContext::Now());
560+
Controls.EnablePutBatching.Update(TActivationContext::Now());
558561
}
559562

560563
void TBlobStorageGroupProxy::Handle(TEvStopBatchingGetRequests::TPtr& ev) {

ydb/core/blobstorage/dsproxy/dsproxy_state.cpp

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -323,12 +323,28 @@ namespace NKikimr {
323323
Send(ev->Sender, new TEvProxySessionsState(Sessions ? Sessions->GroupQueues : nullptr));
324324
}
325325

326+
#define SELECT_CONTROL_BY_DEVICE_TYPE(prefix, info) \
327+
([&](NPDisk::EDeviceType deviceType) -> i64 { \
328+
TInstant now = TActivationContext::Now(); \
329+
switch (deviceType) { \
330+
case NPDisk::DEVICE_TYPE_ROT: \
331+
return Controls.prefix##HDD.Update(now); \
332+
case NPDisk::DEVICE_TYPE_SSD: \
333+
case NPDisk::DEVICE_TYPE_NVME: \
334+
return Controls.prefix##SSD.Update(now); \
335+
default: \
336+
return Controls.prefix.Update(now); \
337+
} \
338+
})(info ? info->GetDeviceType() : NPDisk::DEVICE_TYPE_UNKNOWN)
339+
326340
TAccelerationParams TBlobStorageGroupProxy::GetAccelerationParams() {
327341
return TAccelerationParams{
328-
.SlowDiskThreshold = .001f * SlowDiskThreshold.Update(TActivationContext::Now()),
329-
.PredictedDelayMultiplier = .001f * PredictedDelayMultiplier.Update(TActivationContext::Now()),
330-
.MaxNumOfSlowDisks = (ui32)MaxNumOfSlowDisks.Update(TActivationContext::Now()),
342+
.SlowDiskThreshold = .001f * SELECT_CONTROL_BY_DEVICE_TYPE(SlowDiskThreshold, Info),
343+
.PredictedDelayMultiplier = .001f * SELECT_CONTROL_BY_DEVICE_TYPE(PredictedDelayMultiplier, Info),
344+
.MaxNumOfSlowDisks = static_cast<ui32>(SELECT_CONTROL_BY_DEVICE_TYPE(MaxNumOfSlowDisks, Info)),
331345
};
332346
}
333347

348+
#undef SELECT_CONTROL_BY_DEVICE_TYPE
349+
334350
} // NKikimr

ydb/core/blobstorage/dsproxy/ut/dsproxy_env_mock_ut.h

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,12 @@ struct TDSProxyEnv {
8181
TIntrusivePtr<TStoragePoolCounters> storagePoolCounters = perPoolCounters.GetPoolCounters("pool_name");
8282
TControlWrapper enablePutBatching(DefaultEnablePutBatching, false, true);
8383
TControlWrapper enableVPatch(DefaultEnableVPatch, false, true);
84-
TControlWrapper slowDiskThreshold(DefaultSlowDiskThreshold * 1000, 1, 1000000);
85-
TControlWrapper predictedDelayMultiplier(DefaultPredictedDelayMultiplier * 1000, 1, 1000000);
8684
IActor *dsproxy = CreateBlobStorageGroupProxyConfigured(TIntrusivePtr(Info), true, nodeMon,
8785
std::move(storagePoolCounters), TBlobStorageProxyParameters{
88-
.EnablePutBatching = enablePutBatching,
89-
.EnableVPatch = enableVPatch,
90-
.SlowDiskThreshold = slowDiskThreshold,
91-
.PredictedDelayMultiplier = predictedDelayMultiplier,
86+
.Controls = TBlobStorageProxyControlWrappers{
87+
.EnablePutBatching = enablePutBatching,
88+
.EnableVPatch = enableVPatch,
89+
}
9290
}
9391
);
9492
TActorId actorId = runtime.Register(dsproxy, nodeIndex);

0 commit comments

Comments
 (0)