-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Add a few counters for BlockSTM size #12581
Conversation
@@ -244,6 +244,13 @@ impl DelayedFieldValue { | |||
}, | |||
}) | |||
} | |||
|
|||
pub fn get_approx_memory_size(&self) -> usize { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not spell fully, get_approximate_memory_size
?
|
||
pub fn get_approx_memory_size(&self) -> usize { | ||
match &self { | ||
DelayedFieldValue::Aggregator(_) | DelayedFieldValue::Snapshot(_) => 1 + 16, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please add an explantation here? If I see this code for the first time, comment would be super helpful to explain what this even mean.
pub static BLOCK_VIEW_BASE_VALUES_MEMORY_USAGE: Lazy<HistogramVec> = Lazy::new(|| { | ||
register_avg_counter_vec( | ||
"aptos_execution_block_view_base_values_memory_usage", | ||
"Size (number of keys) ", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line is wrong? Should be values?
name, | ||
desc, | ||
labels, | ||
// We need to have at least one bucket in histogram, otherwise default buckets are used |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: . in the end of a comment
next_idx_to_commit: AtomicTxnIndex, | ||
next_idx_to_commit: CachePadded<AtomicTxnIndex>, | ||
|
||
total_base_value_size: CachePadded<AtomicU64>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You make this cache padded to ensure so that both counters are not colocated on the same cache line, and we avoid invalidations? But what about values
and next_idx_to_commit
. Is the effect actually observable here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's sync up with @gelash when he is back. for now this makes new counter not conflict, doesn't improve on existing conflicts
.entry(id) | ||
.or_insert(VersionedValue::new(Some(base_value))); | ||
use dashmap::mapref::entry::Entry::*; | ||
match self.values.entry(id) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: if let Vacant(...) = ... { ... }
? Or even or_insert_with actually
@@ -1272,6 +1275,8 @@ where | |||
|
|||
ret.resize_with(num_txns, E::Output::skip_output); | |||
|
|||
counters::update_state_counters(unsync_map.stats(), true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This value should be false, right? Because it is sequential?
6203413
to
b9bf67b
Compare
b9bf67b
to
c807df6
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✅ Forge suite
|
✅ Forge suite
|
#12581) (#12594) * Optimize BlockSTM memory usage for delayed fields (#12580) This reduces memory footprint of amortized usage of delayed field with a single version from 3000 bytes to 600 bytes per delayed field. Basically BTreeMap stores things in vectors of 5, and size of the value is large. This invalidates BTreeMap's cache optimization of storing them all together. * Limit number of DelayedFields (aggregators) per resource temporarily, until gas charges for aggregator loading are implemented, limit number of aggregators per resource * Add a few counters for BlockSTM size (#12581) * update TOO_MANY_DELAYED_FIELDS error code (#12603) ---------
Description
Type of Change
Which Components or Systems Does This Change Impact?
How Has This Been Tested?
run forge tests, and looked at the counters
Key Areas to Review
Checklist