diff options
author | serg-belyakov <serg-belyakov@yandex-team.com> | 2023-10-11 17:22:25 +0300 |
---|---|---|
committer | serg-belyakov <serg-belyakov@yandex-team.com> | 2023-10-11 17:56:17 +0300 |
commit | af4a07cb76c6e4700a182bfce4b8ead5440301ca (patch) | |
tree | 83ee997afca7a7481303a43d720e6d39c115f09c | |
parent | bd765c460dee75ea893cf479b4d1cb8bbf85711c (diff) | |
download | ydb-af4a07cb76c6e4700a182bfce4b8ead5440301ca.tar.gz |
Improve TEvVRange cost estimation, fix seek time calculation, KIKIMR-19499
Better TEvVRange cost estimation
-rw-r--r-- | ydb/core/blobstorage/vdisk/common/vdisk_costmodel.cpp | 4 | ||||
-rw-r--r-- | ydb/core/blobstorage/vdisk/common/vdisk_costmodel.h | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/ydb/core/blobstorage/vdisk/common/vdisk_costmodel.cpp b/ydb/core/blobstorage/vdisk/common/vdisk_costmodel.cpp index 7592b2bdd34..6d6f86ef6a7 100644 --- a/ydb/core/blobstorage/vdisk/common/vdisk_costmodel.cpp +++ b/ydb/core/blobstorage/vdisk/common/vdisk_costmodel.cpp @@ -215,7 +215,7 @@ namespace NKikimr { } ui64 TCostModel::ReadCostBySize(ui64 size) const { - ui64 seekCost = (size / ReadBlockSize + 1) * SeekTimeUs; + ui64 seekCost = (size / ReadBlockSize + 1) * SeekTimeUs * 1000ull; ui64 readCost = size * ui64(1000000000) / ReadSpeedBps; return seekCost + readCost; } @@ -231,7 +231,7 @@ namespace NKikimr { cost += InMemReadCost(); } else { // we don't know cost of the query, it depends on number of elements and their size - cost += 10000000; // let's assume it's 10 ms + cost += 1000ull * SeekTimeUs + 2'000'000ull * 1'000'000'000 / ReadSpeedBps; } } diff --git a/ydb/core/blobstorage/vdisk/common/vdisk_costmodel.h b/ydb/core/blobstorage/vdisk/common/vdisk_costmodel.h index e10f519f60b..60da0557d0f 100644 --- a/ydb/core/blobstorage/vdisk/common/vdisk_costmodel.h +++ b/ydb/core/blobstorage/vdisk/common/vdisk_costmodel.h @@ -10,7 +10,7 @@ namespace NKikimr { //////////////////////////////////////////////////////////////////////////// // TCostModel -- estimate complexity of incoming request - // All estimations are performed in time (Us) + // All estimations are performed in time (ns) //////////////////////////////////////////////////////////////////////////// class TCostModel { public: @@ -101,14 +101,14 @@ namespace NKikimr { protected: ui64 SmallWriteCost(ui64 size) const { - const ui64 seekCost = SeekTimeUs / 100u; // assume we do one seek per 100 log records + const ui64 seekCost = SeekTimeUs * 1000ull / 100u; // assume we do one seek per 100 log records const ui64 writeCost = size * ui64(1000000000) / WriteSpeedBps; const ui64 cost = seekCost + writeCost; return cost ? cost : 1; } ui64 HugeWriteCost(ui64 size) const { - const ui64 seekCost = (size / WriteBlockSize + 1) * SeekTimeUs; // huge blocks may require several seeks + const ui64 seekCost = (size / WriteBlockSize + 1) * SeekTimeUs * 1000ull; // huge blocks may require several seeks const ui64 writeCost = size * ui64(1000000000) / WriteSpeedBps; const ui64 cost = seekCost + writeCost; Y_VERIFY_DEBUG(cost); |