(LedgerStore) Report perf metrics for RocksDB deletes (#24138)
#### Summary of Changes This PR enables perf metrics reporting for RocksDB deletes. Samples are reported under "blockstore_rocksdb_write_perf" with op=delete The sampling rate is still controlled by env arg SOLANA_METRICS_ROCKSDB_PERF_SAMPLES_IN_1K and its default to 10 (meaning we report 10 in 1000 perf samples).
This commit is contained in:
parent
b84521d47d
commit
1f136de294
|
@ -800,6 +800,8 @@ pub trait ColumnMetrics {
|
||||||
);
|
);
|
||||||
fn rocksdb_get_perf_metric_header(column_options: &Arc<LedgerColumnOptions>) -> &'static str;
|
fn rocksdb_get_perf_metric_header(column_options: &Arc<LedgerColumnOptions>) -> &'static str;
|
||||||
fn rocksdb_put_perf_metric_header(column_options: &Arc<LedgerColumnOptions>) -> &'static str;
|
fn rocksdb_put_perf_metric_header(column_options: &Arc<LedgerColumnOptions>) -> &'static str;
|
||||||
|
fn rocksdb_delete_perf_metric_header(column_options: &Arc<LedgerColumnOptions>)
|
||||||
|
-> &'static str;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait ColumnName {
|
pub trait ColumnName {
|
||||||
|
@ -911,6 +913,15 @@ impl ColumnMetrics for columns::TransactionStatus {
|
||||||
column_options
|
column_options
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
fn rocksdb_delete_perf_metric_header(
|
||||||
|
column_options: &Arc<LedgerColumnOptions>,
|
||||||
|
) -> &'static str {
|
||||||
|
rocksdb_metric_header!(
|
||||||
|
"blockstore_rocksdb_write_perf,op=delete",
|
||||||
|
"transaction_status",
|
||||||
|
column_options
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
impl ColumnName for columns::TransactionStatus {
|
impl ColumnName for columns::TransactionStatus {
|
||||||
const NAME: &'static str = TRANSACTION_STATUS_CF;
|
const NAME: &'static str = TRANSACTION_STATUS_CF;
|
||||||
|
@ -977,6 +988,15 @@ impl ColumnMetrics for columns::AddressSignatures {
|
||||||
column_options
|
column_options
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
fn rocksdb_delete_perf_metric_header(
|
||||||
|
column_options: &Arc<LedgerColumnOptions>,
|
||||||
|
) -> &'static str {
|
||||||
|
rocksdb_metric_header!(
|
||||||
|
"blockstore_rocksdb_write_perf,op=delete",
|
||||||
|
"address_signatures",
|
||||||
|
column_options
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
impl ColumnName for columns::AddressSignatures {
|
impl ColumnName for columns::AddressSignatures {
|
||||||
const NAME: &'static str = ADDRESS_SIGNATURES_CF;
|
const NAME: &'static str = ADDRESS_SIGNATURES_CF;
|
||||||
|
@ -1033,6 +1053,15 @@ impl ColumnMetrics for columns::TransactionMemos {
|
||||||
column_options
|
column_options
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
fn rocksdb_delete_perf_metric_header(
|
||||||
|
column_options: &Arc<LedgerColumnOptions>,
|
||||||
|
) -> &'static str {
|
||||||
|
rocksdb_metric_header!(
|
||||||
|
"blockstore_rocksdb_write_perf,op=delete",
|
||||||
|
"transaction_memos",
|
||||||
|
column_options
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
impl ColumnName for columns::TransactionMemos {
|
impl ColumnName for columns::TransactionMemos {
|
||||||
const NAME: &'static str = TRANSACTION_MEMOS_CF;
|
const NAME: &'static str = TRANSACTION_MEMOS_CF;
|
||||||
|
@ -1089,6 +1118,15 @@ impl ColumnMetrics for columns::TransactionStatusIndex {
|
||||||
column_options
|
column_options
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
fn rocksdb_delete_perf_metric_header(
|
||||||
|
column_options: &Arc<LedgerColumnOptions>,
|
||||||
|
) -> &'static str {
|
||||||
|
rocksdb_metric_header!(
|
||||||
|
"blockstore_rocksdb_write_perf,op=delete",
|
||||||
|
"transaction_status_index",
|
||||||
|
column_options
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
impl ColumnName for columns::TransactionStatusIndex {
|
impl ColumnName for columns::TransactionStatusIndex {
|
||||||
const NAME: &'static str = TRANSACTION_STATUS_INDEX_CF;
|
const NAME: &'static str = TRANSACTION_STATUS_INDEX_CF;
|
||||||
|
@ -1120,6 +1158,15 @@ impl ColumnMetrics for columns::Rewards {
|
||||||
column_options
|
column_options
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
fn rocksdb_delete_perf_metric_header(
|
||||||
|
column_options: &Arc<LedgerColumnOptions>,
|
||||||
|
) -> &'static str {
|
||||||
|
rocksdb_metric_header!(
|
||||||
|
"blockstore_rocksdb_write_perf,op=delete",
|
||||||
|
"rewards",
|
||||||
|
column_options
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
impl ColumnName for columns::Rewards {
|
impl ColumnName for columns::Rewards {
|
||||||
const NAME: &'static str = REWARDS_CF;
|
const NAME: &'static str = REWARDS_CF;
|
||||||
|
@ -1154,6 +1201,15 @@ impl ColumnMetrics for columns::Blocktime {
|
||||||
column_options
|
column_options
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
fn rocksdb_delete_perf_metric_header(
|
||||||
|
column_options: &Arc<LedgerColumnOptions>,
|
||||||
|
) -> &'static str {
|
||||||
|
rocksdb_metric_header!(
|
||||||
|
"blockstore_rocksdb_write_perf,op=delete",
|
||||||
|
"blocktime",
|
||||||
|
column_options
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
impl ColumnName for columns::Blocktime {
|
impl ColumnName for columns::Blocktime {
|
||||||
const NAME: &'static str = BLOCKTIME_CF;
|
const NAME: &'static str = BLOCKTIME_CF;
|
||||||
|
@ -1188,6 +1244,15 @@ impl ColumnMetrics for columns::PerfSamples {
|
||||||
column_options
|
column_options
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
fn rocksdb_delete_perf_metric_header(
|
||||||
|
column_options: &Arc<LedgerColumnOptions>,
|
||||||
|
) -> &'static str {
|
||||||
|
rocksdb_metric_header!(
|
||||||
|
"blockstore_rocksdb_write_perf,op=delete",
|
||||||
|
"perf_samples",
|
||||||
|
column_options
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
impl ColumnName for columns::PerfSamples {
|
impl ColumnName for columns::PerfSamples {
|
||||||
const NAME: &'static str = PERF_SAMPLES_CF;
|
const NAME: &'static str = PERF_SAMPLES_CF;
|
||||||
|
@ -1222,6 +1287,15 @@ impl ColumnMetrics for columns::BlockHeight {
|
||||||
column_options
|
column_options
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
fn rocksdb_delete_perf_metric_header(
|
||||||
|
column_options: &Arc<LedgerColumnOptions>,
|
||||||
|
) -> &'static str {
|
||||||
|
rocksdb_metric_header!(
|
||||||
|
"blockstore_rocksdb_write_perf,op=delete",
|
||||||
|
"block_height",
|
||||||
|
column_options
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
impl ColumnName for columns::BlockHeight {
|
impl ColumnName for columns::BlockHeight {
|
||||||
const NAME: &'static str = BLOCK_HEIGHT_CF;
|
const NAME: &'static str = BLOCK_HEIGHT_CF;
|
||||||
|
@ -1255,6 +1329,15 @@ impl ColumnMetrics for columns::ProgramCosts {
|
||||||
column_options
|
column_options
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
fn rocksdb_delete_perf_metric_header(
|
||||||
|
column_options: &Arc<LedgerColumnOptions>,
|
||||||
|
) -> &'static str {
|
||||||
|
rocksdb_metric_header!(
|
||||||
|
"blockstore_rocksdb_write_perf,op=delete",
|
||||||
|
"program_costs",
|
||||||
|
column_options
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ColumnName for columns::ProgramCosts {
|
impl ColumnName for columns::ProgramCosts {
|
||||||
|
@ -1335,6 +1418,15 @@ impl ColumnMetrics for columns::ShredCode {
|
||||||
column_options
|
column_options
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
fn rocksdb_delete_perf_metric_header(
|
||||||
|
column_options: &Arc<LedgerColumnOptions>,
|
||||||
|
) -> &'static str {
|
||||||
|
rocksdb_metric_header!(
|
||||||
|
"blockstore_rocksdb_write_perf,op=delete",
|
||||||
|
"shred_code",
|
||||||
|
column_options
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
impl ColumnName for columns::ShredCode {
|
impl ColumnName for columns::ShredCode {
|
||||||
const NAME: &'static str = CODE_SHRED_CF;
|
const NAME: &'static str = CODE_SHRED_CF;
|
||||||
|
@ -1390,6 +1482,15 @@ impl ColumnMetrics for columns::ShredData {
|
||||||
column_options
|
column_options
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
fn rocksdb_delete_perf_metric_header(
|
||||||
|
column_options: &Arc<LedgerColumnOptions>,
|
||||||
|
) -> &'static str {
|
||||||
|
rocksdb_metric_header!(
|
||||||
|
"blockstore_rocksdb_write_perf,op=delete",
|
||||||
|
"shred_data",
|
||||||
|
column_options
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
impl ColumnName for columns::ShredData {
|
impl ColumnName for columns::ShredData {
|
||||||
const NAME: &'static str = DATA_SHRED_CF;
|
const NAME: &'static str = DATA_SHRED_CF;
|
||||||
|
@ -1421,6 +1522,15 @@ impl ColumnMetrics for columns::Index {
|
||||||
column_options
|
column_options
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
fn rocksdb_delete_perf_metric_header(
|
||||||
|
column_options: &Arc<LedgerColumnOptions>,
|
||||||
|
) -> &'static str {
|
||||||
|
rocksdb_metric_header!(
|
||||||
|
"blockstore_rocksdb_write_perf,op=delete",
|
||||||
|
"index",
|
||||||
|
column_options
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
impl ColumnName for columns::Index {
|
impl ColumnName for columns::Index {
|
||||||
const NAME: &'static str = INDEX_CF;
|
const NAME: &'static str = INDEX_CF;
|
||||||
|
@ -1455,6 +1565,15 @@ impl ColumnMetrics for columns::DeadSlots {
|
||||||
column_options
|
column_options
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
fn rocksdb_delete_perf_metric_header(
|
||||||
|
column_options: &Arc<LedgerColumnOptions>,
|
||||||
|
) -> &'static str {
|
||||||
|
rocksdb_metric_header!(
|
||||||
|
"blockstore_rocksdb_write_perf,op=delete",
|
||||||
|
"dead_slots",
|
||||||
|
column_options
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
impl ColumnName for columns::DeadSlots {
|
impl ColumnName for columns::DeadSlots {
|
||||||
const NAME: &'static str = DEAD_SLOTS_CF;
|
const NAME: &'static str = DEAD_SLOTS_CF;
|
||||||
|
@ -1489,6 +1608,15 @@ impl ColumnMetrics for columns::DuplicateSlots {
|
||||||
column_options
|
column_options
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
fn rocksdb_delete_perf_metric_header(
|
||||||
|
column_options: &Arc<LedgerColumnOptions>,
|
||||||
|
) -> &'static str {
|
||||||
|
rocksdb_metric_header!(
|
||||||
|
"blockstore_rocksdb_write_perf,op=delete",
|
||||||
|
"duplicate_slots",
|
||||||
|
column_options
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
impl ColumnName for columns::DuplicateSlots {
|
impl ColumnName for columns::DuplicateSlots {
|
||||||
const NAME: &'static str = DUPLICATE_SLOTS_CF;
|
const NAME: &'static str = DUPLICATE_SLOTS_CF;
|
||||||
|
@ -1523,6 +1651,15 @@ impl ColumnMetrics for columns::Orphans {
|
||||||
column_options
|
column_options
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
fn rocksdb_delete_perf_metric_header(
|
||||||
|
column_options: &Arc<LedgerColumnOptions>,
|
||||||
|
) -> &'static str {
|
||||||
|
rocksdb_metric_header!(
|
||||||
|
"blockstore_rocksdb_write_perf,op=delete",
|
||||||
|
"orphans",
|
||||||
|
column_options
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
impl ColumnName for columns::Orphans {
|
impl ColumnName for columns::Orphans {
|
||||||
const NAME: &'static str = ORPHANS_CF;
|
const NAME: &'static str = ORPHANS_CF;
|
||||||
|
@ -1557,6 +1694,15 @@ impl ColumnMetrics for columns::BankHash {
|
||||||
column_options
|
column_options
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
fn rocksdb_delete_perf_metric_header(
|
||||||
|
column_options: &Arc<LedgerColumnOptions>,
|
||||||
|
) -> &'static str {
|
||||||
|
rocksdb_metric_header!(
|
||||||
|
"blockstore_rocksdb_write_perf,op=delete",
|
||||||
|
"bank_hash",
|
||||||
|
column_options
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
impl ColumnName for columns::BankHash {
|
impl ColumnName for columns::BankHash {
|
||||||
const NAME: &'static str = BANK_HASH_CF;
|
const NAME: &'static str = BANK_HASH_CF;
|
||||||
|
@ -1591,6 +1737,15 @@ impl ColumnMetrics for columns::Root {
|
||||||
column_options
|
column_options
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
fn rocksdb_delete_perf_metric_header(
|
||||||
|
column_options: &Arc<LedgerColumnOptions>,
|
||||||
|
) -> &'static str {
|
||||||
|
rocksdb_metric_header!(
|
||||||
|
"blockstore_rocksdb_write_perf,op=delete",
|
||||||
|
"root",
|
||||||
|
column_options
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
impl ColumnName for columns::Root {
|
impl ColumnName for columns::Root {
|
||||||
const NAME: &'static str = ROOT_CF;
|
const NAME: &'static str = ROOT_CF;
|
||||||
|
@ -1625,6 +1780,15 @@ impl ColumnMetrics for columns::SlotMeta {
|
||||||
column_options
|
column_options
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
fn rocksdb_delete_perf_metric_header(
|
||||||
|
column_options: &Arc<LedgerColumnOptions>,
|
||||||
|
) -> &'static str {
|
||||||
|
rocksdb_metric_header!(
|
||||||
|
"blockstore_rocksdb_write_perf,op=delete",
|
||||||
|
"slot_meta",
|
||||||
|
column_options
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
impl ColumnName for columns::SlotMeta {
|
impl ColumnName for columns::SlotMeta {
|
||||||
const NAME: &'static str = META_CF;
|
const NAME: &'static str = META_CF;
|
||||||
|
@ -1684,6 +1848,15 @@ impl ColumnMetrics for columns::ErasureMeta {
|
||||||
column_options
|
column_options
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
fn rocksdb_delete_perf_metric_header(
|
||||||
|
column_options: &Arc<LedgerColumnOptions>,
|
||||||
|
) -> &'static str {
|
||||||
|
rocksdb_metric_header!(
|
||||||
|
"blockstore_rocksdb_write_perf,op=delete",
|
||||||
|
"erasure_meta",
|
||||||
|
column_options
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
impl ColumnName for columns::ErasureMeta {
|
impl ColumnName for columns::ErasureMeta {
|
||||||
const NAME: &'static str = ERASURE_META_CF;
|
const NAME: &'static str = ERASURE_META_CF;
|
||||||
|
@ -2416,7 +2589,12 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn delete(&self, key: C::Index) -> Result<()> {
|
pub fn delete(&self, key: C::Index) -> Result<()> {
|
||||||
self.backend.delete_cf(self.handle(), &C::key(key))
|
let is_perf_context_enabled = maybe_collect_perf_context();
|
||||||
|
let result = self.backend.delete_cf(self.handle(), &C::key(key));
|
||||||
|
if is_perf_context_enabled {
|
||||||
|
report_write_perf_context(C::rocksdb_delete_perf_metric_header(&self.column_options));
|
||||||
|
}
|
||||||
|
result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue