Skip to content

Commit

Permalink
chore: remove mem table memory metrics (#13604)
Browse files Browse the repository at this point in the history
  • Loading branch information
wcy-fdu authored Nov 23, 2023
1 parent b3866b7 commit 53c5250
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 83 deletions.
2 changes: 1 addition & 1 deletion docker/dashboards/risingwave-dev-dashboard.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docker/dashboards/risingwave-user-dashboard.json

Large diffs are not rendered by default.

32 changes: 0 additions & 32 deletions grafana/risingwave-dev-dashboard.dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -1684,38 +1684,6 @@ def section_batch(outer_panels):
),
],
),
panels.timeseries_bytes(
"Mem Table Size",
"This metric shows the memory usage of mem_table.",
[
panels.target(
f"sum({metric('state_store_mem_table_memory_size')}) by ({COMPONENT_LABEL}, {NODE_LABEL})",
"mem_table size total - {{%s}} @ {{%s}}"
% (COMPONENT_LABEL, NODE_LABEL),
),
panels.target(
f"{metric('state_store_mem_table_memory_size')}",
"mem_table size - table id {{table_id}} instance id {{instance_id}} {{%s}} @ {{%s}}"
% (COMPONENT_LABEL, NODE_LABEL),
),
],
),
panels.timeseries_count(
"Mem Table Count",
"This metric shows the item counts in mem_table.",
[
panels.target(
f"sum({metric('state_store_mem_table_item_count')}) by ({COMPONENT_LABEL}, {NODE_LABEL})",
"mem_table counts total - {{%s}} @ {{%s}}"
% (COMPONENT_LABEL, NODE_LABEL),
),
panels.target(
f"{metric('state_store_mem_table_item_count')}",
"mem_table count - table id {{table_id}} instance id {{instance_id}} {{%s}} @ {{%s}}"
% (COMPONENT_LABEL, NODE_LABEL),
),
],
),
panels.timeseries_latency(
"Row SeqScan Next Duration",
"",
Expand Down
2 changes: 1 addition & 1 deletion grafana/risingwave-dev-dashboard.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion grafana/risingwave-user-dashboard.json

Large diffs are not rendered by default.

26 changes: 1 addition & 25 deletions src/storage/src/hummock/store/local_hummock_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ use std::sync::Arc;
use await_tree::InstrumentAwait;
use bytes::Bytes;
use parking_lot::RwLock;
use prometheus::IntGauge;
use risingwave_common::catalog::{TableId, TableOption};
use risingwave_common::util::epoch::{MAX_EPOCH, MAX_SPILL_TIMES};
use risingwave_hummock_sdk::key::{TableKey, TableKeyRange};
Expand Down Expand Up @@ -92,10 +91,6 @@ pub struct LocalHummockStorage {

version_update_notifier_tx: Arc<tokio::sync::watch::Sender<HummockEpoch>>,

mem_table_size: IntGauge,

mem_table_item_count: IntGauge,

mem_table_spill_threshold: usize,
}

Expand Down Expand Up @@ -274,28 +269,19 @@ impl LocalStateStore for LocalHummockStorage {
Some(old_val) => self.mem_table.update(key, old_val, new_val)?,
};

self.mem_table_size
.set(self.mem_table.kv_size.size() as i64);
self.mem_table_item_count
.set(self.mem_table.buffer.len() as i64);
Ok(())
}

fn delete(&mut self, key: TableKey<Bytes>, old_val: Bytes) -> StorageResult<()> {
self.mem_table.delete(key, old_val)?;
self.mem_table_size
.set(self.mem_table.kv_size.size() as i64);
self.mem_table_item_count
.set(self.mem_table.buffer.len() as i64);

Ok(())
}

async fn flush(
&mut self,
delete_ranges: Vec<(Bound<Bytes>, Bound<Bytes>)>,
) -> StorageResult<usize> {
self.mem_table_size.set(0);
self.mem_table_item_count.set(0);
debug_assert!(delete_ranges
.iter()
.map(|(key, _)| key)
Expand Down Expand Up @@ -533,14 +519,6 @@ impl LocalHummockStorage {
mem_table_spill_threshold: usize,
) -> Self {
let stats = hummock_version_reader.stats().clone();
let mem_table_size = stats.mem_table_memory_size.with_label_values(&[
&option.table_id.to_string(),
&instance_guard.instance_id.to_string(),
]);
let mem_table_item_count = stats.mem_table_item_count.with_label_values(&[
&option.table_id.to_string(),
&instance_guard.instance_id.to_string(),
]);
Self {
mem_table: MemTable::new(option.is_consistent_op),
spill_offset: 0,
Expand All @@ -557,8 +535,6 @@ impl LocalHummockStorage {
stats,
write_limiter,
version_update_notifier_tx,
mem_table_size,
mem_table_item_count,
mem_table_spill_threshold,
}
}
Expand Down
24 changes: 2 additions & 22 deletions src/storage/src/monitor/hummock_state_store_metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ use std::sync::{Arc, OnceLock};
use prometheus::core::{AtomicU64, Collector, Desc, GenericCounter, GenericGauge};
use prometheus::{
exponential_buckets, histogram_opts, proto, register_histogram_vec_with_registry,
register_int_counter_vec_with_registry, register_int_gauge_vec_with_registry,
register_int_gauge_with_registry, Gauge, IntGauge, IntGaugeVec, Opts, Registry,
register_int_counter_vec_with_registry, register_int_gauge_with_registry, Gauge, IntGauge,
Opts, Registry,
};
use risingwave_common::config::MetricLevel;
use risingwave_common::metrics::{
Expand Down Expand Up @@ -75,8 +75,6 @@ pub struct HummockStateStoreMetrics {
pub uploader_uploading_task_size: GenericGauge<AtomicU64>,

// memory
pub mem_table_memory_size: IntGaugeVec,
pub mem_table_item_count: IntGaugeVec,
pub mem_table_spill_counts: RelabeledCounterVec,
}

Expand Down Expand Up @@ -359,22 +357,6 @@ impl HummockStateStoreMetrics {
metric_level,
);

let mem_table_memory_size = register_int_gauge_vec_with_registry!(
"state_store_mem_table_memory_size",
"Memory usage of mem_table",
&["table_id", "instance_id"],
registry
)
.unwrap();

let mem_table_item_count = register_int_gauge_vec_with_registry!(
"state_store_mem_table_item_count",
"Item counts in mem_table",
&["table_id", "instance_id"],
registry
)
.unwrap();

let mem_table_spill_counts = register_int_counter_vec_with_registry!(
"state_store_mem_table_spill_counts",
"Total number of mem table spill occurs for one table",
Expand Down Expand Up @@ -413,8 +395,6 @@ impl HummockStateStoreMetrics {
spill_task_size_from_sealed: spill_task_size.with_label_values(&["sealed"]),
spill_task_size_from_unsealed: spill_task_size.with_label_values(&["unsealed"]),
uploader_uploading_task_size,
mem_table_memory_size,
mem_table_item_count,
mem_table_spill_counts,
}
}
Expand Down

0 comments on commit 53c5250

Please sign in to comment.