Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

(LedgerStore) Move metric sample counters out from LedgerColumnOptions #25042

Merged
merged 1 commit into from
May 10, 2022
Merged

(LedgerStore) Move metric sample counters out from LedgerColumnOptions #25042

merged 1 commit into from
May 10, 2022

Conversation

yhchiang-sol
Copy link
Contributor

@yhchiang-sol yhchiang-sol commented May 6, 2022

Problem

LedgerColumnOptions contain two fields, perf_read_counter and perf_write_counter,
that are not really options but internal counters.

Summary of Changes

This PR introduces BlockstoreRocksDbPerfSamplingStatus, a struct that holds internal
status for RocksDB perf sampling and moves perf_read_counter and perf_write_counter
out from LedgerColumnOptions.

@yhchiang-sol yhchiang-sol marked this pull request as draft May 6, 2022 10:00
@yhchiang-sol yhchiang-sol marked this pull request as ready for review May 6, 2022 11:03
@yhchiang-sol yhchiang-sol marked this pull request as draft May 6, 2022 18:55
@yhchiang-sol
Copy link
Contributor Author

The PR needs some update as we changed the direction to a rate-limiting approach. Put this PR back to draft.

@yhchiang-sol yhchiang-sol marked this pull request as ready for review May 9, 2022 06:27
@codecov
Copy link

codecov bot commented May 9, 2022

Codecov Report

Merging #25042 (e6b5a24) into master (69a0ff9) will increase coverage by 0.0%.
The diff coverage is 81.7%.

@@           Coverage Diff            @@
##           master   #25042    +/-   ##
========================================
  Coverage    82.0%    82.0%            
========================================
  Files         598      602     +4     
  Lines      165882   166830   +948     
========================================
+ Hits       136125   136931   +806     
- Misses      29757    29899   +142     

steviez
steviez previously approved these changes May 10, 2022
Copy link
Contributor

@steviez steviez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just the one nit, otherwise, looks good to me

@@ -338,6 +340,7 @@ impl Rocks {
access_type: access_type.clone(),
oldest_slot,
column_options,
write_perf_status: BlockstoreRocksDbPerfSamplingStatus::default(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: rename to "write_batch_perf_status" to help clarify that this is for the WriteBatch codepath

@mergify mergify bot dismissed steviez’s stale review May 10, 2022 20:59

Pull request has been modified.

@yhchiang-sol yhchiang-sol merged commit b2dcda8 into solana-labs:master May 10, 2022
@yhchiang-sol yhchiang-sol deleted the column-internal branch May 10, 2022 23:13
@@ -511,6 +512,13 @@ pub(crate) fn report_rocksdb_write_perf(metric_header: &'static str) {
});
}

#[derive(Debug, Default, Clone)]
/// A struct that holds the current status of RocksDB perf sampling.
pub struct BlockstoreRocksDbPerfSamplingStatus {
Copy link
Contributor

@behzadnouri behzadnouri May 12, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Such long names actually reduce readability of the code.
Within this module and blockstore module it is clear that this is blockstore specific.
outside this module, this is already qualified by the name of the module:

blockstore_metrics::BlockstoreRocksDbPerfSamplingStatus

So there is no need to repeat Blockstore twice.
Also there is no use for mentioning RocksDb in the name. Does this struct or user of this struct care if the backend is rocks-db or something else? Should we change this struct if backend changes?

yhchiang-sol added a commit that referenced this pull request May 16, 2022
…omicUsize (#25043)

#### Problem
After #25042, each LedgerColumn has its own BlockstoreRocksDbWritePerfMetrics
and BlockstoreRocksDbReadPerfMetrics instances.  As it has total ownership,
its member field does not need to use Arc.

#### Summary of Changes
Change perf_samples_counter from Arc<AtomicUsize> to AtomicUsize
under BlockstoreRocksDbWritePerfMetrics and BlockstoreRocksDbReadPerfMetrics.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
rust Pull requests that update Rust code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants