Skip to content

Commit a814333

Browse files
committed
Fix request unit calculator references and description (#19692)
1 parent 47f4292 commit a814333

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

ydb/core/tx/schemeshard/schemeshard_billing_helpers.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,25 @@ TString TBillingStats::ToString() const {
4040
}
4141

4242
ui64 TRUCalculator::ReadTable(ui64 bytes) {
43+
// The ReadTable operation lets you efficiently read large ranges of data from a table.
44+
// The request cost only depends on the amount of data read based on the rate of 128 RU per 1 MB.
45+
// When calculating the cost, the amount is rounded up to a multiple of 1 MB.
46+
// https://yandex.cloud/en-ru/docs/ydb/pricing/ru-special#readtable
4347
return 128 * ((bytes + 1_MB - 1) / 1_MB);
4448
}
4549

4650
ui64 TRUCalculator::BulkUpsert(ui64 bytes, ui64 rows) {
51+
// BulkUpsert lets you efficiently upload data to the database.
52+
// The cost of writing a row using the BulkUpsert operation is 0.5 RU per 1 KB of written data.
53+
// When calculating the cost, the data amount is rounded up to a multiple of 1 KB.
54+
// The total cost of the operation is calculated as the sum of costs for all rows written, with the result rounded up to the nearest integer.
55+
// https://yandex.cloud/en-ru/docs/ydb/pricing/ru-special#bulkupsert
4756
return (Max(rows, (bytes + 1_KB - 1) / 1_KB) + 1) / 2;
4857
}
4958

5059
ui64 TRUCalculator::Calculate(const TBillingStats& stats) {
60+
// The cost of building an index is the sum of the cost of ReadTable from the source table and BulkUpsert to the index table.
61+
// https://yandex.cloud/en-ru/docs/ydb/pricing/ru-special#secondary-index
5162
return TRUCalculator::ReadTable(stats.GetReadBytes())
5263
+ TRUCalculator::BulkUpsert(stats.GetUploadBytes(), stats.GetUploadRows());
5364
}

ydb/core/tx/schemeshard/schemeshard_billing_helpers.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ class TBillingStats {
5252
};
5353

5454
struct TRUCalculator {
55-
// https://a.yandex-team.ru/arc/trunk/arcadia/kikimr/docs/ru/pricing/serverless.md
5655
static ui64 ReadTable(ui64 bytes);
5756
static ui64 BulkUpsert(ui64 bytes, ui64 rows);
5857
static ui64 Calculate(const TBillingStats& stats);

0 commit comments

Comments
 (0)