Skip to content

Commit

Permalink
Remove expensive mem usage stats (MystenLabs#10803)
Browse files Browse the repository at this point in the history
## Description 

These metrics are heavy cpu user, and not very much used for anything.

## Test Plan 

Existing tests
  • Loading branch information
sadhansood authored Apr 12, 2023
1 parent 142ba94 commit 8a5c1fb
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 56 deletions.
24 changes: 0 additions & 24 deletions crates/typed-store/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -807,9 +807,6 @@ pub struct DBMetrics {
pub cf_metrics: ColumnFamilyMetrics,
pub read_perf_ctx_metrics: ReadPerfContextMetrics,
pub write_perf_ctx_metrics: WritePerfContextMetrics,
pub rocksdb_mem_table_usage: IntGaugeVec,
pub rocksdb_unflushed_mem_table_usage: IntGaugeVec,
pub rocksdb_table_readers_usage: IntGaugeVec,
}

static ONCE: OnceCell<Arc<DBMetrics>> = OnceCell::new();
Expand All @@ -821,27 +818,6 @@ impl DBMetrics {
cf_metrics: ColumnFamilyMetrics::new(registry),
read_perf_ctx_metrics: ReadPerfContextMetrics::new(registry),
write_perf_ctx_metrics: WritePerfContextMetrics::new(registry),
rocksdb_mem_table_usage: register_int_gauge_vec_with_registry!(
"rocksdb_mem_table_usage",
"The estimated memory usage of the all memtables in the db",
&["db_name"],
registry,
)
.unwrap(),
rocksdb_unflushed_mem_table_usage: register_int_gauge_vec_with_registry!(
"rocksdb_unflushed_mem_table_usage",
"The estimated memory usage of unflushed memtables in the db",
&["db_name"],
registry,
)
.unwrap(),
rocksdb_table_readers_usage: register_int_gauge_vec_with_registry!(
"rocksdb_table_readers_usage",
"The estimated memory usage of all table readers",
&["db_name"],
registry,
)
.unwrap(),
}
}
pub fn init(registry: &Registry) -> &'static Arc<DBMetrics> {
Expand Down
32 changes: 0 additions & 32 deletions crates/typed-store/src/rocks/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -871,38 +871,6 @@ impl<K, V> DBMap<K, V> {
Self::get_int_property(rocksdb, &cf, properties::BACKGROUND_ERRORS)
.unwrap_or(METRICS_ERROR),
);
let db_name = rocksdb.db_name();
if let RocksDB::DBWithThreadMode(ref rocksdb) = **rocksdb {
let mem_usage_stats =
rocksdb::perf::get_memory_usage_stats(Some(&[&rocksdb.underlying]), None);
db_metrics
.rocksdb_mem_table_usage
.with_label_values(&[&db_name])
.set(
mem_usage_stats
.as_ref()
.map(|x| x.mem_table_total as i64)
.unwrap_or(METRICS_ERROR),
);
db_metrics
.rocksdb_unflushed_mem_table_usage
.with_label_values(&[&db_name])
.set(
mem_usage_stats
.as_ref()
.map(|x| x.mem_table_unflushed as i64)
.unwrap_or(METRICS_ERROR),
);
db_metrics
.rocksdb_table_readers_usage
.with_label_values(&[&db_name])
.set(
mem_usage_stats
.as_ref()
.map(|x| x.mem_table_readers_total as i64)
.unwrap_or(METRICS_ERROR),
);
}
}

pub fn transaction(&self) -> Result<DBTransaction<'_>, TypedStoreError> {
Expand Down

0 comments on commit 8a5c1fb

Please sign in to comment.