Skip to content

Commit b481980

Browse files
authored
throttling: use device speed from pdisk cost model (#14452)
1 parent d1b4cd3 commit b481980

File tree

6 files changed

+11
-23
lines changed

6 files changed

+11
-23
lines changed

ydb/core/blobstorage/nodewarden/node_warden_impl.cpp

-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ TNodeWarden::TNodeWarden(const TIntrusivePtr<TNodeWardenConfig> &cfg)
3131
, DefaultHugeGarbagePerMille(300, 1, 1000)
3232
, HugeDefragFreeSpaceBorderPerMille(260, 1, 1000)
3333
, MaxChunksToDefragInflight(10, 1, 50)
34-
, ThrottlingDeviceSpeed(50 << 20, 1 << 20, 10ull << 30)
3534
, ThrottlingDryRun(1, 0, 1)
3635
, ThrottlingMinLevel0SstCount(100, 1, 1000)
3736
, ThrottlingMaxLevel0SstCount(250, 1, 1000)
@@ -355,7 +354,6 @@ void TNodeWarden::Bootstrap() {
355354
icb->RegisterSharedControl(HugeDefragFreeSpaceBorderPerMille, "VDiskControls.HugeDefragFreeSpaceBorderPerMille");
356355
icb->RegisterSharedControl(MaxChunksToDefragInflight, "VDiskControls.MaxChunksToDefragInflight");
357356

358-
icb->RegisterSharedControl(ThrottlingDeviceSpeed, "VDiskControls.ThrottlingDeviceSpeed");
359357
icb->RegisterSharedControl(ThrottlingDryRun, "VDiskControls.ThrottlingDryRun");
360358
icb->RegisterSharedControl(ThrottlingMinLevel0SstCount, "VDiskControls.ThrottlingMinLevel0SstCount");
361359
icb->RegisterSharedControl(ThrottlingMaxLevel0SstCount, "VDiskControls.ThrottlingMaxLevel0SstCount");

ydb/core/blobstorage/nodewarden/node_warden_impl.h

-1
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,6 @@ namespace NKikimr::NStorage {
180180
TControlWrapper HugeDefragFreeSpaceBorderPerMille;
181181
TControlWrapper MaxChunksToDefragInflight;
182182

183-
TControlWrapper ThrottlingDeviceSpeed;
184183
TControlWrapper ThrottlingDryRun;
185184
TControlWrapper ThrottlingMinLevel0SstCount;
186185
TControlWrapper ThrottlingMaxLevel0SstCount;

ydb/core/blobstorage/nodewarden/node_warden_vdisk.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,6 @@ namespace NKikimr::NStorage {
200200
vdiskConfig->MaxSyncLogChunksInFlight = MaxSyncLogChunksInFlightSSD;
201201
}
202202

203-
vdiskConfig->ThrottlingDeviceSpeed = ThrottlingDeviceSpeed;
204203
vdiskConfig->ThrottlingDryRun = ThrottlingDryRun;
205204
vdiskConfig->ThrottlingMinLevel0SstCount = ThrottlingMinLevel0SstCount;
206205
vdiskConfig->ThrottlingMaxLevel0SstCount = ThrottlingMaxLevel0SstCount;

ydb/core/blobstorage/vdisk/common/vdisk_config.h

-1
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,6 @@ namespace NKikimr {
246246
TCostMetricsParametersByMedia CostMetricsParametersByMedia;
247247

248248
///////////// THROTTLING SETTINGS //////////////////
249-
TControlWrapper ThrottlingDeviceSpeed;
250249
TControlWrapper ThrottlingDryRun;
251250
TControlWrapper ThrottlingMinLevel0SstCount;
252251
TControlWrapper ThrottlingMaxLevel0SstCount;

ydb/core/blobstorage/vdisk/skeleton/skeleton_overload_handler.cpp

+10-13
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,8 @@ namespace NKikimr {
184184
TIntrusivePtr<TVDiskConfig> VCfg;
185185
TPDiskCtxPtr PDiskCtx;
186186

187+
ui64 WriteSpeedBps = 100'000'000;
188+
187189
TControlWrapper ThrottlingMinInplacedSize;
188190
TControlWrapper ThrottlingMaxInplacedSize;
189191

@@ -211,35 +213,31 @@ namespace NKikimr {
211213
}
212214

213215
ui64 CalcSstCountSpeedLimit() const {
214-
ui64 deviceSpeed = (ui64)VCfg->ThrottlingDeviceSpeed;
215216
ui64 minSstCount = (ui64)VCfg->ThrottlingMinLevel0SstCount;
216217
ui64 maxSstCount = (ui64)VCfg->ThrottlingMaxLevel0SstCount;
217218

218-
return LinearInterpolation(CurrentSstCount, minSstCount, maxSstCount, deviceSpeed);
219+
return LinearInterpolation(CurrentSstCount, minSstCount, maxSstCount, WriteSpeedBps);
219220
}
220221

221222
ui64 CalcInplacedSizeSpeedLimit() const {
222-
ui64 deviceSpeed = (ui64)VCfg->ThrottlingDeviceSpeed;
223223
ui64 minInplacedSize = (ui64)ThrottlingMinInplacedSize;
224224
ui64 maxInplacedSize = (ui64)ThrottlingMaxInplacedSize;
225225

226-
return LinearInterpolation(CurrentInplacedSize, minInplacedSize, maxInplacedSize, deviceSpeed);
226+
return LinearInterpolation(CurrentInplacedSize, minInplacedSize, maxInplacedSize, WriteSpeedBps);
227227
}
228228

229229
ui64 CalcOccupancySpeedLimit() const {
230-
ui64 deviceSpeed = (ui64)VCfg->ThrottlingDeviceSpeed;
231230
ui64 minOccupancy = (ui64)VCfg->ThrottlingMinOccupancyPerMille * 1000;
232231
ui64 maxOccupancy = (ui64)VCfg->ThrottlingMaxOccupancyPerMille * 1000;
233232

234-
return LinearInterpolation(CurrentOccupancy, minOccupancy, maxOccupancy, deviceSpeed);
233+
return LinearInterpolation(CurrentOccupancy, minOccupancy, maxOccupancy, WriteSpeedBps);
235234
}
236235

237236
ui64 CalcLogChunkCountSpeedLimit() const {
238-
ui64 deviceSpeed = (ui64)VCfg->ThrottlingDeviceSpeed;
239237
ui64 minLogChunkCount = (ui64)VCfg->ThrottlingMinLogChunkCount;
240238
ui64 maxLogChunkCount = (ui64)VCfg->ThrottlingMaxLogChunkCount;
241239

242-
return LinearInterpolation(CurrentLogChunkCount, minLogChunkCount, maxLogChunkCount, deviceSpeed);
240+
return LinearInterpolation(CurrentLogChunkCount, minLogChunkCount, maxLogChunkCount, WriteSpeedBps);
243241
}
244242

245243
ui64 CalcSpeedLimit() const {
@@ -267,6 +265,7 @@ namespace NKikimr {
267265
NPDisk::EDeviceType mediaType = NPDisk::DEVICE_TYPE_UNKNOWN;
268266
if (PDiskCtx && PDiskCtx->Dsk) {
269267
mediaType = PDiskCtx->Dsk->TrueMediaType;
268+
WriteSpeedBps = PDiskCtx->Dsk->WriteSpeedBps;
270269
}
271270
if (mediaType == NPDisk::DEVICE_TYPE_UNKNOWN) {
272271
mediaType = VCfg->BaseInfo.DeviceType;
@@ -304,8 +303,7 @@ namespace NKikimr {
304303
if (!IsActive()) {
305304
return 1000;
306305
}
307-
ui64 deviceSpeed = (ui64)VCfg->ThrottlingDeviceSpeed;
308-
double rate = (double)CurrentSpeedLimit / deviceSpeed;
306+
double rate = (double)CurrentSpeedLimit / WriteSpeedBps;
309307
return rate * 1000;
310308
}
311309

@@ -360,7 +358,7 @@ namespace NKikimr {
360358
if (!IsActive()) {
361359
CurrentTime = {};
362360
AvailableBytes = 0;
363-
CurrentSpeedLimit = (ui64)VCfg->ThrottlingDeviceSpeed;
361+
CurrentSpeedLimit = WriteSpeedBps;
364362
} else {
365363
if (!prevActive) {
366364
CurrentTime = now;
@@ -378,8 +376,7 @@ namespace NKikimr {
378376
}
379377
auto us = (now - CurrentTime).MicroSeconds();
380378
AvailableBytes += CurrentSpeedLimit * us / 1000000;
381-
ui64 deviceSpeed = (ui64)VCfg->ThrottlingDeviceSpeed;
382-
AvailableBytes = std::min(AvailableBytes, deviceSpeed);
379+
AvailableBytes = std::min(AvailableBytes, WriteSpeedBps);
383380
CurrentTime = now;
384381
}
385382
};

ydb/core/protos/config.proto

+1-5
Original file line numberDiff line numberDiff line change
@@ -1388,11 +1388,7 @@ message TImmediateControlsConfig {
13881388
MaxValue: 50,
13891389
DefaultValue: 10 }];
13901390

1391-
optional uint64 ThrottlingDeviceSpeed = 14 [(ControlOptions) = {
1392-
Description: "Maximum allowed speed when throttling is active",
1393-
MinValue: 1048576,
1394-
MaxValue: 10737418240,
1395-
DefaultValue: 52428800 }];
1391+
reserved 14;
13961392
optional uint64 ThrottlingDryRun = 26 [(ControlOptions) = {
13971393
Description: "0 - working mode, 1 - dry run mode",
13981394
MinValue: 0,

0 commit comments

Comments
 (0)