mirror of https://github.com/facebook/rocksdb.git
New PerfContext counters for block cache bytes read (#12459)
Summary: Add PerfContext counters for measuring the cumulative size of blocks found in the block cache. Pull Request resolved: https://github.com/facebook/rocksdb/pull/12459 Reviewed By: ajkr Differential Revision: D55170694 Pulled By: anand1976 fbshipit-source-id: 8cbba76eece116cefce7f00e2fc9d74757661d25
This commit is contained in:
parent
13e1c32a18
commit
98d8a85624
|
@ -83,6 +83,11 @@ struct PerfContextBase {
|
|||
uint64_t filter_block_read_count; // total number of filter block reads
|
||||
uint64_t compression_dict_block_read_count; // total number of compression
|
||||
// dictionary block reads
|
||||
// Cumulative size of blocks found in block cache
|
||||
uint64_t block_cache_index_read_byte;
|
||||
uint64_t block_cache_filter_read_byte;
|
||||
uint64_t block_cache_compression_dict_read_byte;
|
||||
uint64_t block_cache_read_byte;
|
||||
|
||||
uint64_t secondary_cache_hit_count; // total number of secondary cache hits
|
||||
// total number of real handles inserted into secondary cache
|
||||
|
|
|
@ -167,6 +167,54 @@ jlong Java_org_rocksdb_PerfContext_getBlockReadCpuTime(JNIEnv*, jobject,
|
|||
return perf_context->block_read_cpu_time;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_rocksdb_PerfContext
|
||||
* Method: getBlockCacheIndexReadByte
|
||||
* Signature: (J)J
|
||||
*/
|
||||
jlong Java_org_rocksdb_PerfContext_getBlockCacheIndexReadByte(
|
||||
JNIEnv*, jobject, jlong jpc_handle) {
|
||||
ROCKSDB_NAMESPACE::PerfContext* perf_context =
|
||||
reinterpret_cast<ROCKSDB_NAMESPACE::PerfContext*>(jpc_handle);
|
||||
return perf_context->block_cache_index_read_byte;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_rocksdb_PerfContext
|
||||
* Method: getBlockCacheFilterReadByte
|
||||
* Signature: (J)J
|
||||
*/
|
||||
jlong Java_org_rocksdb_PerfContext_getBlockCacheFilterReadByte(
|
||||
JNIEnv*, jobject, jlong jpc_handle) {
|
||||
ROCKSDB_NAMESPACE::PerfContext* perf_context =
|
||||
reinterpret_cast<ROCKSDB_NAMESPACE::PerfContext*>(jpc_handle);
|
||||
return perf_context->block_cache_filter_read_byte;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_rocksdb_PerfContext
|
||||
* Method: getBlockCacheCompressionDictReadByte
|
||||
* Signature: (J)J
|
||||
*/
|
||||
jlong Java_org_rocksdb_PerfContext_getBlockCacheCompressionDictReadByte(
|
||||
JNIEnv*, jobject, jlong jpc_handle) {
|
||||
ROCKSDB_NAMESPACE::PerfContext* perf_context =
|
||||
reinterpret_cast<ROCKSDB_NAMESPACE::PerfContext*>(jpc_handle);
|
||||
return perf_context->block_cache_compression_dict_read_byte;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_rocksdb_PerfContext
|
||||
* Method: getBlockCacheReadByte
|
||||
* Signature: (J)J
|
||||
*/
|
||||
jlong Java_org_rocksdb_PerfContext_getBlockCacheReadByte(JNIEnv*, jobject,
|
||||
jlong jpc_handle) {
|
||||
ROCKSDB_NAMESPACE::PerfContext* perf_context =
|
||||
reinterpret_cast<ROCKSDB_NAMESPACE::PerfContext*>(jpc_handle);
|
||||
return perf_context->block_cache_read_byte;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_rocksdb_PerfContext
|
||||
* Method: getSecondaryCacheHitCount
|
||||
|
|
|
@ -62,6 +62,10 @@ struct PerfContextByLevelInt {
|
|||
defCmd(block_cache_filter_hit_count) \
|
||||
defCmd(filter_block_read_count) \
|
||||
defCmd(compression_dict_block_read_count) \
|
||||
defCmd(block_cache_index_read_byte) \
|
||||
defCmd(block_cache_filter_read_byte) \
|
||||
defCmd(block_cache_compression_dict_read_byte) \
|
||||
defCmd(block_cache_read_byte) \
|
||||
defCmd(secondary_cache_hit_count) \
|
||||
defCmd(compressed_sec_cache_insert_real_count) \
|
||||
defCmd(compressed_sec_cache_insert_dummy_count) \
|
||||
|
|
|
@ -217,6 +217,7 @@ void BlockBasedTable::UpdateCacheHitMetrics(BlockType block_type,
|
|||
Statistics* const statistics = rep_->ioptions.stats;
|
||||
|
||||
PERF_COUNTER_ADD(block_cache_hit_count, 1);
|
||||
PERF_COUNTER_ADD(block_cache_read_byte, usage);
|
||||
PERF_COUNTER_BY_LEVEL_ADD(block_cache_hit_count, 1,
|
||||
static_cast<uint32_t>(rep_->level));
|
||||
|
||||
|
@ -232,6 +233,7 @@ void BlockBasedTable::UpdateCacheHitMetrics(BlockType block_type,
|
|||
case BlockType::kFilter:
|
||||
case BlockType::kFilterPartitionIndex:
|
||||
PERF_COUNTER_ADD(block_cache_filter_hit_count, 1);
|
||||
PERF_COUNTER_ADD(block_cache_filter_read_byte, usage);
|
||||
|
||||
if (get_context) {
|
||||
++get_context->get_context_stats_.num_cache_filter_hit;
|
||||
|
@ -242,6 +244,7 @@ void BlockBasedTable::UpdateCacheHitMetrics(BlockType block_type,
|
|||
|
||||
case BlockType::kCompressionDictionary:
|
||||
// TODO: introduce perf counter for compression dictionary hit count
|
||||
PERF_COUNTER_ADD(block_cache_compression_dict_read_byte, usage);
|
||||
if (get_context) {
|
||||
++get_context->get_context_stats_.num_cache_compression_dict_hit;
|
||||
} else {
|
||||
|
@ -251,6 +254,7 @@ void BlockBasedTable::UpdateCacheHitMetrics(BlockType block_type,
|
|||
|
||||
case BlockType::kIndex:
|
||||
PERF_COUNTER_ADD(block_cache_index_hit_count, 1);
|
||||
PERF_COUNTER_ADD(block_cache_index_read_byte, usage);
|
||||
|
||||
if (get_context) {
|
||||
++get_context->get_context_stats_.num_cache_index_hit;
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Added new PerfContext counters for block cache bytes read - block_cache_index_read_byte, block_cache_filter_read_byte, block_cache_compression_dict_read_byte, and block_cache_read_byte.
|
Loading…
Reference in New Issue