Skip to content

Commit 8ebf595

Browse files
authored
Configure BufferPool size depending on device type (#9764)
1 parent 45718ca commit 8ebf595

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

ydb/core/blobstorage/pdisk/blobstorage_pdisk_config.h

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,9 @@ struct TPDiskConfig : public TThrRefBase {
123123
ui64 CostLimitNs;
124124

125125
// AsyncBlockDevice settings
126-
ui32 BufferPoolBufferSizeBytes = 512 << 10;
127-
ui32 BufferPoolBufferCount = 256;
128-
ui32 MaxQueuedCompletionActions = 128; // BufferPoolBufferCount / 2;
126+
ui32 BufferPoolBufferSizeBytes;
127+
ui32 BufferPoolBufferCount;
128+
ui32 MaxQueuedCompletionActions;
129129
bool UseSpdkNvmeDriver;
130130

131131
ui64 ExpectedSlotCount = 0;
@@ -211,6 +211,10 @@ struct TPDiskConfig : public TThrRefBase {
211211
DeviceInFlight = choose(128, 4, hddInFlight);
212212
CostLimitNs = choose(500'000ull, 20'000'000ull, 50'000'000ull);
213213

214+
BufferPoolBufferSizeBytes = choose(128 << 10, 256 << 10, 512 << 10);
215+
BufferPoolBufferCount = choose(1024, 512, 256);
216+
MaxQueuedCompletionActions = BufferPoolBufferCount / 2;
217+
214218
UseSpdkNvmeDriver = Path.StartsWith("PCIe:");
215219
Y_ABORT_UNLESS(!UseSpdkNvmeDriver || deviceType == NPDisk::DEVICE_TYPE_NVME,
216220
"SPDK NVMe driver can be used only with NVMe devices!");

ydb/core/blobstorage/pdisk/blobstorage_pdisk_impl.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,12 @@ TPDisk::TPDisk(std::shared_ptr<TPDiskCtx> pCtx, const TIntrusivePtr<TPDiskConfig
6060
0, 64 * 1024 * 1024);
6161
ForsetiMaxLogBatchNs = TControlWrapper((PDiskCategory.IsSolidState() ? 50'000ll : 500'000ll), 0, 100'000'000ll);
6262
ForsetiMaxLogBatchNsCached = ForsetiMaxLogBatchNs;
63-
ForsetiOpPieceSizeSsd = TControlWrapper(64 * 1024, 1, 512 * 1024);
64-
ForsetiOpPieceSizeRot = TControlWrapper(512 * 1024, 1, 512 * 1024);
63+
ForsetiOpPieceSizeSsd = TControlWrapper(64 * 1024, 1, Cfg->BufferPoolBufferSizeBytes);
64+
ForsetiOpPieceSizeRot = TControlWrapper(512 * 1024, 1, Cfg->BufferPoolBufferSizeBytes);
6565
ForsetiOpPieceSizeCached = PDiskCategory.IsSolidState() ? ForsetiOpPieceSizeSsd : ForsetiOpPieceSizeRot;
6666

67+
68+
6769
if (Cfg->SectorMap) {
6870
auto diskModeParams = Cfg->SectorMap->GetDiskModeParams();
6971
if (diskModeParams) {
@@ -3419,12 +3421,12 @@ void TPDisk::Update() {
34193421
Mon.UpdateDurationTracker.UpdateStarted();
34203422
LWTRACK(PDiskUpdateStarted, UpdateCycleOrbit, PCtx->PDiskId);
34213423

3424+
ForsetiMaxLogBatchNsCached = ForsetiMaxLogBatchNs;
3425+
ForsetiOpPieceSizeCached = PDiskCategory.IsSolidState() ? ForsetiOpPieceSizeSsd : ForsetiOpPieceSizeRot;
3426+
ForsetiOpPieceSizeCached = Min<i64>(ForsetiOpPieceSizeCached, Cfg->BufferPoolBufferSizeBytes);
3427+
ForsetiOpPieceSizeCached = AlignDown<i64>(ForsetiOpPieceSizeCached, Format.SectorSize);
34223428
{
34233429
TGuard<TMutex> guard(StateMutex);
3424-
ForsetiMaxLogBatchNsCached = ForsetiMaxLogBatchNs;
3425-
ForsetiOpPieceSizeCached = PDiskCategory.IsSolidState() ? ForsetiOpPieceSizeSsd : ForsetiOpPieceSizeRot;
3426-
ForsetiOpPieceSizeCached = Min<i64>(ForsetiOpPieceSizeCached, Cfg->BufferPoolBufferSizeBytes);
3427-
ForsetiOpPieceSizeCached = AlignDown<i64>(ForsetiOpPieceSizeCached, Format.SectorSize);
34283430
// Switch the scheduler when possible
34293431
ForsetiScheduler.SetIsBinLogEnabled(EnableForsetiBinLog);
34303432

0 commit comments

Comments
 (0)