yugabyte / yugabyte-db

YugabyteDB - the cloud native distributed SQL database for mission-critical applications.
https://www.yugabyte.com
Other
8.99k stars 1.07k forks source link

[DocDB] Fix statistic RocksDB_read_block_get_micros to include all reads #11744

Open fritshoogland-yugabyte opened 2 years ago

fritshoogland-yugabyte commented 2 years ago

Jira Link: DB-948

Description

(thanks to an investigation with @ttyusupov)

Currently in YB version 2.13.0.0 build 42, the statistic rocksdb_read_block_get_micros is only measured and incremented for any read that has the intention to populate the block based cache. This means that for a read with the block based cache disabled, this statistic is not incremented.

This is fixed in the rocksdb main code with pull request 3442. I think it makes sense to correct this in our code too.

That brings a visibility problem: currently the difference between rocksdb_sst_read_micros (number of read calls submitted to the OS) and rocksdb_read_block_get_micros gives an indication of the number of blocks read for compaction. With the above fix, compaction will add to the rocksdb_read_block_get_micros statistic, and thus the number of DocDB client reads cannot be derived.

I would suggest create a specific read block statistic for compaction, such as rocksdb_read_block_compaction_get_micros, and a statistic rocksdb_read_block_request_get_micros for DocDB client requests, so the two can be differentiated.

bmatican commented 2 years ago

@rthallamko3 Might be an ok starter in rocksdb & metrics