row_cache: Add metric for dummy row hits

This will help to diagnose performance problems related to the read
having to walk through a lot of dummy rows to fill the buffer.

Refs #8153
This commit is contained in:
Tomasz Grabiec
2021-02-24 16:37:32 +01:00
parent 495b7b5596
commit f0a3272a5f
3 changed files with 9 additions and 0 deletions

View File

@@ -619,6 +619,8 @@ void cache_flat_mutation_reader::add_to_buffer(const partition_snapshot_row_curs
if (!row.dummy()) {
_read_context->cache().on_row_hit();
add_clustering_row_to_buffer(mutation_fragment(*_schema, _permit, row.row(_read_context->digest_requested())));
} else {
_read_context->cache()._tracker.on_dummy_row_hit();
}
}

View File

@@ -108,6 +108,7 @@ cache_tracker::setup_metrics() {
sm::make_derive("partition_misses", sm::description("number of partitions needed by reads and missing in cache"), _stats.partition_misses),
sm::make_derive("partition_insertions", sm::description("total number of partitions added to cache"), _stats.partition_insertions),
sm::make_derive("row_hits", sm::description("total number of rows needed by reads and found in cache"), _stats.row_hits),
sm::make_derive("dummy_row_hits", sm::description("total number of dummy rows touched by reads in cache"), _stats.dummy_row_hits),
sm::make_derive("row_misses", sm::description("total number of rows needed by reads and missing in cache"), _stats.row_misses),
sm::make_derive("row_insertions", sm::description("total number of rows added to cache"), _stats.row_insertions),
sm::make_derive("row_evictions", sm::description("total number of rows evicted from cache"), _stats.row_evictions),
@@ -200,6 +201,10 @@ void cache_tracker::on_row_hit() noexcept {
++_stats.row_hits;
}
void cache_tracker::on_dummy_row_hit() noexcept {
++_stats.dummy_row_hits;
}
void cache_tracker::on_row_miss() noexcept {
++_stats.row_misses;
}

View File

@@ -165,6 +165,7 @@ public:
uint64_t partition_hits;
uint64_t partition_misses;
uint64_t row_hits;
uint64_t dummy_row_hits;
uint64_t row_misses;
uint64_t partition_insertions;
uint64_t row_insertions;
@@ -221,6 +222,7 @@ public:
void on_partition_eviction() noexcept;
void on_row_eviction() noexcept;
void on_row_hit() noexcept;
void on_dummy_row_hit() noexcept;
void on_row_miss() noexcept;
void on_miss_already_populated() noexcept;
void on_mispopulate() noexcept;