Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

experimental release w/ cache enabled #18102

Draft
wants to merge 2 commits into
base: releases/sui-v1.26.0-release
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion crates/sui-core/src/authority/authority_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1316,7 +1316,6 @@ impl AuthorityStore {
objects: &[ObjectRef],
is_force_reset: bool,
) -> SuiResult {
trace!(?objects, "initialize_locks");
AuthorityStore::initialize_live_object_markers(
&self.perpetual_tables.live_owned_object_markers,
write_batch,
Expand Down
20 changes: 3 additions & 17 deletions crates/sui-core/src/execution_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use crate::transaction_outputs::TransactionOutputs;
use sui_types::bridge::Bridge;

use futures::{future::BoxFuture, FutureExt};
use prometheus::{register_int_gauge_with_registry, IntGauge, Registry};
use prometheus::Registry;
use std::collections::HashSet;
use std::path::Path;
use std::sync::Arc;
Expand All @@ -38,6 +38,7 @@ use sui_types::{
use tracing::instrument;

pub(crate) mod cache_types;
pub mod metrics;
mod object_locks;
pub mod passthrough_cache;
pub mod proxy_cache;
Expand All @@ -47,22 +48,7 @@ pub use passthrough_cache::PassthroughCache;
pub use proxy_cache::ProxyCache;
pub use writeback_cache::WritebackCache;

pub struct ExecutionCacheMetrics {
pending_notify_read: IntGauge,
}

impl ExecutionCacheMetrics {
pub fn new(registry: &Registry) -> Self {
Self {
pending_notify_read: register_int_gauge_with_registry!(
"pending_notify_read",
"Pending notify read requests",
registry,
)
.unwrap(),
}
}
}
use metrics::ExecutionCacheMetrics;

// If you have Arc<ExecutionCache>, you cannot return a reference to it as
// an &Arc<dyn ExecutionCacheRead> (for example), because the trait object is a fat pointer.
Expand Down
111 changes: 111 additions & 0 deletions crates/sui-core/src/execution_cache/metrics.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
// Copyright (c) Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0

use prometheus::{
register_int_counter_vec_with_registry, register_int_gauge_with_registry, IntCounterVec,
IntGauge, Registry,
};

pub struct ExecutionCacheMetrics {
pub(crate) pending_notify_read: IntGauge,
pub(crate) cache_requests: IntCounterVec,
pub(crate) cache_hits: IntCounterVec,
pub(crate) cache_negative_hits: IntCounterVec,
pub(crate) cache_misses: IntCounterVec,
pub(crate) cache_writes: IntCounterVec,
}

impl ExecutionCacheMetrics {
pub fn new(registry: &Registry) -> Self {
Self {
pending_notify_read: register_int_gauge_with_registry!(
"pending_notify_read",
"Pending notify read requests",
registry,
)
.unwrap(),
// `request_type` is "object_by_version", "object_latest", "transaction", etc
// level in these metrics may be "uncommitted", "committed", "package_cache" or "db"
cache_requests: register_int_counter_vec_with_registry!(
"execution_cache_requests",
"Execution cache requests",
&["request_type", "level"],
registry,
)
.unwrap(),
cache_hits: register_int_counter_vec_with_registry!(
"execution_cache_hits",
"Execution cache hits",
&["request_type", "level"],
registry,
)
.unwrap(),
cache_negative_hits: register_int_counter_vec_with_registry!(
"execution_cache_negative_hits",
"Execution cache negative hits",
&["request_type", "level"],
registry,
)
.unwrap(),
cache_misses: register_int_counter_vec_with_registry!(
"execution_cache_misses",
"Execution cache misses",
&["request_type", "level"],
registry,
)
.unwrap(),

// `collection` should be "object", "marker", "transaction_effects", etc
cache_writes: register_int_counter_vec_with_registry!(
"execution_cache_writes",
"Execution cache writes",
&["collection"],
registry,
)
.unwrap(),
}
}

pub(crate) fn record_cache_request(&self, request_type: &'static str, level: &'static str) {
self.cache_requests
.with_label_values(&[request_type, level])
.inc();
}

pub(crate) fn record_cache_multi_request(
&self,
request_type: &'static str,
level: &'static str,
count: usize,
) {
self.cache_requests
.with_label_values(&[request_type, level])
.inc_by(count as u64);
}

pub(crate) fn record_cache_hit(&self, request_type: &'static str, level: &'static str) {
self.cache_hits
.with_label_values(&[request_type, level])
.inc();
}

pub(crate) fn record_cache_miss(&self, request_type: &'static str, level: &'static str) {
self.cache_misses
.with_label_values(&[request_type, level])
.inc();
}

pub(crate) fn record_cache_negative_hit(
&self,
request_type: &'static str,
level: &'static str,
) {
self.cache_negative_hits
.with_label_values(&[request_type, level])
.inc();
}

pub(crate) fn record_cache_write(&self, collection: &'static str) {
self.cache_writes.with_label_values(&[collection]).inc();
}
}
Loading
Loading