Skip to content

Commit

Permalink
Add cost estimator for NVME disks (#1443)
Browse files Browse the repository at this point in the history
  • Loading branch information
serbel324 authored Jan 31, 2024
1 parent c2c1997 commit 736e7ff
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ const TDiskOperationCostEstimator TBsCostModelBase::HDDEstimator{
{ 6.089e+06, 8.1 }, // HugeWriteCoefficients
};

const TDiskOperationCostEstimator TBsCostModelBase::NVMEEstimator{
{ 10000, 1.3 }, // ReadCoefficients
{ 3300, 1.5 }, // WriteCoefficients
{ 50000, 1.83 }, // HugeWriteCoefficients
};

class TBsCostModelMirror3dc : public TBsCostModelBase {
public:
TBsCostModelMirror3dc(NPDisk::EDeviceType deviceType)
Expand Down
10 changes: 10 additions & 0 deletions ydb/core/blobstorage/vdisk/common/blobstorage_cost_tracker.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ class TBsCostModelBase {
ui64 PDiskWriteBlockSize = 4ull * 1'000'000; // 4MB

static const TDiskOperationCostEstimator HDDEstimator;
static const TDiskOperationCostEstimator NVMEEstimator;

private:
enum class EMemoryOperationType {
Expand Down Expand Up @@ -99,6 +100,9 @@ class TBsCostModelBase {
case NPDisk::DEVICE_TYPE_ROT: {
return HDDEstimator.Write(chunkSize);
}
case NPDisk::DEVICE_TYPE_NVME: {
return NVMEEstimator.Write(chunkSize);
}
default: {
ui64 seekTime = DeviceSeekTimeNs / 100u; // assume we do one seek per 100 log records
ui64 writeTime = chunkSize * 1'000'000'000ull / DeviceWriteSpeedBps;
Expand All @@ -112,6 +116,9 @@ class TBsCostModelBase {
case NPDisk::DEVICE_TYPE_ROT: {
return HDDEstimator.HugeWrite(chunkSize);
}
case NPDisk::DEVICE_TYPE_NVME: {
return NVMEEstimator.HugeWrite(chunkSize);
}
default: {
ui64 blocksNumber = (chunkSize + DeviceWriteBlockSize - 1) / DeviceWriteBlockSize;
ui64 seekTime = 1. * blocksNumber * DeviceSeekTimeNs;
Expand All @@ -126,6 +133,9 @@ class TBsCostModelBase {
case NPDisk::DEVICE_TYPE_ROT: {
return HDDEstimator.Read(chunkSize);
}
case NPDisk::DEVICE_TYPE_NVME: {
return NVMEEstimator.Read(chunkSize);
}
default: {
ui64 blocksNumber = (chunkSize + DeviceReadBlockSize - 1) / DeviceReadBlockSize;
ui64 seekTime = 1. * blocksNumber * DeviceSeekTimeNs;
Expand Down

0 comments on commit 736e7ff

Please sign in to comment.