Skip to content

perf(db): prebind cursor operation metrics#23654

Merged
mediocregopher merged 8 commits into
mainfrom
auto-opt/20260420-db-op-metrics-fast-path
Apr 29, 2026
Merged

perf(db): prebind cursor operation metrics#23654
mediocregopher merged 8 commits into
mainfrom
auto-opt/20260420-db-op-metrics-fast-path

Conversation

@mediocregopher
Copy link
Copy Markdown
Member

@mediocregopher mediocregopher commented Apr 20, 2026

Prebinds per-table MDBX cursor operation metrics in DatabaseEnvMetrics and passes those cached handles into new cursors from Tx::new_cursor. This keeps the metric names unchanged while removing the per-operation metric lookup and clone from hot cursor write paths.

@mediocregopher
Copy link
Copy Markdown
Member Author

derek bench blocks=200 slack=never

@decofe
Copy link
Copy Markdown
Member

decofe commented Apr 20, 2026

cc @mediocregopher

✅ Benchmark complete! View job

Benchmark Results

⚠️ Feature is 5 commits behind main. Consider rebasing for accurate results.

Metric main auto-opt/20260420-db-op-metrics-fast-path Change
Mean 55.88ms 56.12ms +0.44% ⚪ (±17.68%)
StdDev 71.77ms 73.28ms
P50 33.79ms 33.74ms -0.15% ⚪ (±6.51%)
P90 117.76ms 99.54ms -15.47% ⚪ (±70.81%)
P99 364.32ms 361.82ms -0.69% ⚪ (±25.05%)
Mgas/s 797.95 814.68 +2.10% ⚪ (±5.20%)
Wall Clock 22.76s 22.84s +0.36% ⚪ (±17.36%)
Persist Wait 21.62ms 21.73ms +0.52% ⚪ (±45.44%)

200 blocks, 200 warmup

Wait Time Breakdown

Persistence Wait

Metric main auto-opt/20260420-db-op-metrics-fast-path
Mean 21.62ms 21.73ms
P50 0.02ms 0.02ms
P95 206.28ms 237.07ms

Trie Cache Update Wait

Metric main auto-opt/20260420-db-op-metrics-fast-path
Mean 0.49ms 0.46ms
P50 0.00ms 0.00ms
P95 2.42ms 2.39ms

Execution Cache Update Wait

Metric main auto-opt/20260420-db-op-metrics-fast-path
Mean 0.01ms 0.00ms
P50 0.00ms 0.00ms
P95 0.00ms 0.00ms

Grafana Dashboard

Charts

Latency, Throughput & Diff

Latency, Throughput & Diff

Wait Time Breakdown

Wait Time Breakdown

Gas vs Latency

Gas vs Latency

Grafana Dashboard

View real-time metrics

@mediocregopher
Copy link
Copy Markdown
Member Author

derek bench big-blocks blocks=50 slack=never

@decofe
Copy link
Copy Markdown
Member

decofe commented Apr 20, 2026

cc @mediocregopher

✅ Benchmark complete! View job

Benchmark Results

⚠️ Feature is 5 commits behind main. Consider rebasing for accurate results.

Metric main auto-opt/20260420-db-op-metrics-fast-path Change
Mean 837.76ms 842.20ms +0.53% ⚪ (±2.67%)
StdDev 200.29ms 201.61ms
P50 789.04ms 781.16ms -1.00% ⚪ (±6.45%)
P90 1123.41ms 1172.04ms +4.33% ⚪ (±6.83%)
P99 1415.60ms 1399.90ms -1.11% ⚪ (±7.81%)
Mgas/s 1278.55 1272.96 -0.44% ⚪ (±2.16%)
Wall Clock 85.06s 85.56s +0.59% ⚪ (±2.77%)
Persist Wait 0.72ms 0.06ms -91.30% ⚪ (±130.30%)

50 big blocks, 20 warmup

Wait Time Breakdown

Persistence Wait

Metric main auto-opt/20260420-db-op-metrics-fast-path
Mean 0.72ms 0.06ms
P50 0.06ms 0.06ms
P95 0.12ms 0.09ms

Trie Cache Update Wait

Metric main auto-opt/20260420-db-op-metrics-fast-path
Mean 0.00ms 0.00ms
P50 0.00ms 0.00ms
P95 0.00ms 0.00ms

Execution Cache Update Wait

Metric main auto-opt/20260420-db-op-metrics-fast-path
Mean 0.00ms 0.00ms
P50 0.00ms 0.00ms
P95 0.00ms 0.00ms

Grafana Dashboard

Charts

Latency, Throughput & Diff

Latency, Throughput & Diff

Wait Time Breakdown

Wait Time Breakdown

Gas vs Latency

Gas vs Latency

Grafana Dashboard

View real-time metrics

@mediocregopher
Copy link
Copy Markdown
Member Author

derek bench blocks=2000 slack=on-win

@decofe
Copy link
Copy Markdown
Member

decofe commented Apr 20, 2026

cc @mediocregopher

✅ Benchmark complete! View job

Benchmark Results

⚠️ Feature is 5 commits behind main. Consider rebasing for accurate results.

Metric main auto-opt/20260420-db-op-metrics-fast-path Change
Mean 58.60ms 59.19ms +1.01% ⚪ (±5.90%)
StdDev 85.44ms 87.44ms
P50 27.93ms 28.31ms +1.37% ❌ (±1.37%)
P90 207.91ms 185.48ms -10.79% ⚪ (±14.98%)
P99 378.50ms 403.31ms +6.55% ❌ (±5.97%)
Mgas/s 950.64 940.67 -1.05% ⚪ (±1.44%)
Wall Clock 238.21s 240.57s +0.99% ⚪ (±5.80%)
Persist Wait 29.20ms 29.36ms +0.54% ⚪ (±11.74%)

2000 blocks, 200 warmup

Wait Time Breakdown

Persistence Wait

Metric main auto-opt/20260420-db-op-metrics-fast-path
Mean 29.20ms 29.36ms
P50 0.02ms 0.03ms
P95 254.92ms 262.53ms

Trie Cache Update Wait

Metric main auto-opt/20260420-db-op-metrics-fast-path
Mean 0.58ms 0.64ms
P50 0.07ms 0.05ms
P95 2.61ms 2.83ms

Execution Cache Update Wait

Metric main auto-opt/20260420-db-op-metrics-fast-path
Mean 0.00ms 0.00ms
P50 0.00ms 0.00ms
P95 0.00ms 0.00ms

Grafana Dashboard

Charts

Latency, Throughput & Diff

Latency, Throughput & Diff

Wait Time Breakdown

Wait Time Breakdown

Gas vs Latency

Gas vs Latency

Grafana Dashboard

View real-time metrics

@mediocregopher
Copy link
Copy Markdown
Member Author

derek bench big-blocks blocks=500 slack=on-win

@decofe
Copy link
Copy Markdown
Member

decofe commented Apr 20, 2026

cc @mediocregopher

🚀 Benchmark queued! View run

Status: Waiting for runner...

Config: blocks: big, baseline: main, feature: auto-opt/20260420-db-op-metrics-fast-path, slack: on-win

@mediocregopher
Copy link
Copy Markdown
Member Author

derek bench blocks=200 slack=never

@decofe
Copy link
Copy Markdown
Member

decofe commented Apr 20, 2026

cc @mediocregopher

✅ Benchmark complete! View job

Benchmark Results

⚠️ Feature is 5 commits behind main. Consider rebasing for accurate results.

Metric main auto-opt/20260420-db-op-metrics-fast-path Change
Mean 61.43ms 58.62ms -4.57% ⚪ (±14.53%)
StdDev 85.25ms 80.53ms
P50 35.22ms 33.56ms -4.70% ⚪ (±5.56%)
P90 127.12ms 124.54ms -2.03% ⚪ (±52.99%)
P99 446.65ms 437.53ms -2.04% ⚪ (±15.19%)
Mgas/s 794.39 815.01 +2.60% ⚪ (±3.92%)
Wall Clock 24.98s 23.85s -4.54% ⚪ (±14.29%)
Persist Wait 25.12ms 24.37ms -2.98% ⚪ (±35.03%)

200 blocks, 200 warmup

Wait Time Breakdown

Persistence Wait

Metric main auto-opt/20260420-db-op-metrics-fast-path
Mean 25.12ms 24.37ms
P50 0.02ms 0.02ms
P95 218.29ms 238.94ms

Trie Cache Update Wait

Metric main auto-opt/20260420-db-op-metrics-fast-path
Mean 0.48ms 0.46ms
P50 0.00ms 0.00ms
P95 2.41ms 2.37ms

Execution Cache Update Wait

Metric main auto-opt/20260420-db-op-metrics-fast-path
Mean 0.00ms 0.00ms
P50 0.00ms 0.00ms
P95 0.00ms 0.00ms

Grafana Dashboard

Charts

Latency, Throughput & Diff

Latency, Throughput & Diff

Wait Time Breakdown

Wait Time Breakdown

Gas vs Latency

Gas vs Latency

Grafana Dashboard

View real-time metrics

@mediocregopher
Copy link
Copy Markdown
Member Author

derek bench big-blocks blocks=50 slack=never

@decofe
Copy link
Copy Markdown
Member

decofe commented Apr 20, 2026

cc @mediocregopher

✅ Benchmark complete! View job

Benchmark Results

⚠️ Feature is 5 commits behind main. Consider rebasing for accurate results.

Metric main auto-opt/20260420-db-op-metrics-fast-path Change
Mean 843.48ms 835.45ms -0.95% ⚪ (±2.39%)
StdDev 200.35ms 186.84ms
P50 781.61ms 783.49ms +0.24% ⚪ (±6.57%)
P90 1158.79ms 1124.75ms -2.94% ⚪ (±5.31%)
P99 1434.22ms 1339.06ms -6.64% ✅ (±3.48%)
Mgas/s 1268.96 1275.85 +0.54% ⚪ (±2.19%)
Wall Clock 85.70s 84.81s -1.04% ⚪ (±2.45%)
Persist Wait 0.06ms 0.24ms +281.40% ⚪ (±488.57%)

50 big blocks, 20 warmup

Wait Time Breakdown

Persistence Wait

Metric main auto-opt/20260420-db-op-metrics-fast-path
Mean 0.06ms 0.24ms
P50 0.06ms 0.06ms
P95 0.09ms 0.12ms

Trie Cache Update Wait

Metric main auto-opt/20260420-db-op-metrics-fast-path
Mean 0.00ms 0.00ms
P50 0.00ms 0.00ms
P95 0.00ms 0.00ms

Execution Cache Update Wait

Metric main auto-opt/20260420-db-op-metrics-fast-path
Mean 0.00ms 0.00ms
P50 0.00ms 0.00ms
P95 0.00ms 0.00ms

Grafana Dashboard

Charts

Latency, Throughput & Diff

Latency, Throughput & Diff

Wait Time Breakdown

Wait Time Breakdown

Gas vs Latency

Gas vs Latency

Grafana Dashboard

View real-time metrics

@mediocregopher
Copy link
Copy Markdown
Member Author

derek bench blocks=2000 slack=on-win

@decofe
Copy link
Copy Markdown
Member

decofe commented Apr 20, 2026

cc @mediocregopher

✅ Benchmark complete! View job

Benchmark Results

⚠️ Feature is 5 commits behind main. Consider rebasing for accurate results.

Metric main auto-opt/20260420-db-op-metrics-fast-path Change
Mean 58.91ms 59.00ms +0.15% ⚪ (±5.30%)
StdDev 86.69ms 86.56ms
P50 27.99ms 27.66ms -1.16% ✅ (±1.13%)
P90 200.67ms 213.81ms +6.55% ⚪ (±13.89%)
P99 403.58ms 385.30ms -4.53% ⚪ (±5.21%)
Mgas/s 948.90 954.03 +0.54% ⚪ (±1.28%)
Wall Clock 239.45s 239.88s +0.18% ⚪ (±5.22%)
Persist Wait 29.39ms 29.69ms +0.99% ⚪ (±10.54%)

2000 blocks, 200 warmup

Wait Time Breakdown

Persistence Wait

Metric main auto-opt/20260420-db-op-metrics-fast-path
Mean 29.39ms 29.69ms
P50 0.02ms 0.02ms
P95 254.34ms 259.07ms

Trie Cache Update Wait

Metric main auto-opt/20260420-db-op-metrics-fast-path
Mean 0.59ms 0.59ms
P50 0.06ms 0.07ms
P95 2.58ms 2.67ms

Execution Cache Update Wait

Metric main auto-opt/20260420-db-op-metrics-fast-path
Mean 0.00ms 0.00ms
P50 0.00ms 0.00ms
P95 0.00ms 0.00ms

Grafana Dashboard

Charts

Latency, Throughput & Diff

Latency, Throughput & Diff

Wait Time Breakdown

Wait Time Breakdown

Gas vs Latency

Gas vs Latency

Grafana Dashboard

View real-time metrics

@mediocregopher
Copy link
Copy Markdown
Member Author

derek bench big-blocks blocks=500 slack=on-win

@decofe
Copy link
Copy Markdown
Member

decofe commented Apr 20, 2026

cc @mediocregopher

✅ Benchmark complete! View job

Benchmark Results

⚠️ Feature is 7 commits behind main. Consider rebasing for accurate results.

Metric main auto-opt/20260420-db-op-metrics-fast-path Change
Mean 799.43ms 802.60ms +0.40% ⚪ (±1.53%)
StdDev 197.95ms 198.57ms
P50 752.82ms 749.31ms -0.47% ⚪ (±1.91%)
P90 1007.65ms 1027.74ms +1.99% ⚪ (±2.27%)
P99 1735.45ms 1579.90ms -8.96% ⚪ (±18.66%)
Mgas/s 1330.45 1325.15 -0.40% ⚪ (±1.26%)
Wall Clock 831.28s 835.01s +0.45% ⚪ (±1.93%)
Persist Wait 2.88ms 2.25ms -21.93% ⚪ (±77.93%)

500 big blocks, 20 warmup

Wait Time Breakdown

Persistence Wait

Metric main auto-opt/20260420-db-op-metrics-fast-path
Mean 2.88ms 2.25ms
P50 0.06ms 0.06ms
P95 0.09ms 0.09ms

Trie Cache Update Wait

Metric main auto-opt/20260420-db-op-metrics-fast-path
Mean 0.48ms 0.59ms
P50 0.00ms 0.00ms
P95 0.00ms 0.00ms

Execution Cache Update Wait

Metric main auto-opt/20260420-db-op-metrics-fast-path
Mean 0.00ms 0.00ms
P50 0.00ms 0.00ms
P95 0.00ms 0.00ms

Grafana Dashboard

Charts

Latency, Throughput & Diff

Latency, Throughput & Diff

Wait Time Breakdown

Wait Time Breakdown

Gas vs Latency

Gas vs Latency

Grafana Dashboard

View real-time metrics

@mediocregopher mediocregopher marked this pull request as ready for review April 20, 2026 16:43
@mediocregopher
Copy link
Copy Markdown
Member Author

Benchmark-validated WIN (escalated).

Results

@mediocregopher mediocregopher changed the title [autoopt] 20260420-1-db-op-metrics-fast-path perf(db): prebind cursor operation metrics Apr 27, 2026
@github-project-automation github-project-automation Bot moved this to Backlog in Reth Tracker Apr 27, 2026
@mediocregopher mediocregopher self-assigned this Apr 27, 2026
Co-authored-by: Brian Picciano <933154+mediocregopher@users.noreply.github.com>
Amp-Thread-ID: https://ampcode.com/threads/T-019dce13-c0cb-7700-8208-d890370e38ed
Co-authored-by: Amp <amp@ampcode.com>
Comment thread crates/storage/db/src/metrics.rs Outdated
mediocregopher and others added 2 commits April 28, 2026 13:37
Co-Authored-By: Brian Picciano <933154+mediocregopher@users.noreply.github.com>
Co-authored-by: Brian Picciano <933154+mediocregopher@users.noreply.github.com>
Amp-Thread-ID: https://ampcode.com/threads/T-019dd44d-3253-710b-bc57-9795eb2dfb6a
Co-authored-by: Amp <amp@ampcode.com>
@decofe
Copy link
Copy Markdown
Member

decofe commented Apr 28, 2026

cc @mediocregopher

❌ Benchmark failed while unknown step. View logs

Co-Authored-By: Brian Picciano <933154+mediocregopher@users.noreply.github.com>
@mediocregopher
Copy link
Copy Markdown
Member Author

derek bench blocks=2000

@decofe
Copy link
Copy Markdown
Member

decofe commented Apr 28, 2026

cc @mediocregopher

✅ Benchmark complete! View job

Benchmark Results

⚠️ Feature is 1 commit behind main. Consider rebasing for accurate results.

Metric main auto-opt/20260420-db-op-metrics-fast-path Change
Mean 29.96ms 29.90ms -0.22% ⚪ (±1.22%)
StdDev 23.58ms 23.68ms
P50 24.28ms 24.47ms +0.81% ⚪ (±1.07%)
P90 48.24ms 47.58ms -1.37% ⚪ (±3.19%)
P99 138.52ms 138.59ms +0.05% ⚪ (±9.70%)
Mgas/s 1148.97 1151.20 +0.19% ⚪ (±0.54%)
Wall Clock 123.58s 123.37s -0.17% ⚪ (±1.19%)
Persist Wait 23.06ms 23.43ms +1.60% ⚪ (±13.62%)

2000 blocks, 200 warmup

Wait Time Breakdown

Persistence Wait

Metric main auto-opt/20260420-db-op-metrics-fast-path
Mean 23.06ms 23.43ms
P50 0.02ms 0.02ms
P95 213.48ms 221.20ms

Trie Cache Update Wait

Metric main auto-opt/20260420-db-op-metrics-fast-path
Mean 0.41ms 0.44ms
P50 0.01ms 0.05ms
P95 1.79ms 1.86ms

Execution Cache Update Wait

Metric main auto-opt/20260420-db-op-metrics-fast-path
Mean 0.00ms 0.00ms
P50 0.00ms 0.00ms
P95 0.00ms 0.00ms

Grafana Dashboard

Charts

Latency, Throughput & Diff

Latency, Throughput & Diff

Wait Time Breakdown

Wait Time Breakdown

Gas vs Latency

Gas vs Latency

Grafana Dashboard

View real-time metrics

mediocregopher and others added 3 commits April 28, 2026 14:49
Co-authored-by: Brian Picciano <933154+mediocregopher@users.noreply.github.com>
Amp-Thread-ID: https://ampcode.com/threads/T-019dd44d-3253-710b-bc57-9795eb2dfb6a
Co-authored-by: Amp <amp@ampcode.com>
Co-authored-by: Brian Picciano <933154+mediocregopher@users.noreply.github.com>
Amp-Thread-ID: https://ampcode.com/threads/T-019dd44d-3253-710b-bc57-9795eb2dfb6a
Co-authored-by: Amp <amp@ampcode.com>
Co-authored-by: Brian Picciano <933154+mediocregopher@users.noreply.github.com>
Amp-Thread-ID: https://ampcode.com/threads/T-019dd44d-3253-710b-bc57-9795eb2dfb6a
Co-authored-by: Amp <amp@ampcode.com>
@mediocregopher mediocregopher added this pull request to the merge queue Apr 29, 2026
Merged via the queue into main with commit a12454d Apr 29, 2026
34 checks passed
@mediocregopher mediocregopher deleted the auto-opt/20260420-db-op-metrics-fast-path branch April 29, 2026 11:51
@github-project-automation github-project-automation Bot moved this from In Progress to Done in Reth Tracker Apr 29, 2026
umeeSthein pushed a commit to umeeSthein/tempo that referenced this pull request Apr 30, 2026
Automated nightly update of reth dependencies from `paradigmxyz/reth`
main branch.

## Upstream reth changes


[`73ec2c9...88505c7`](paradigmxyz/reth@73ec2c9...88505c7)

🔗 Amp thread:
https://ampcode.com/threads/T-019dd952-f354-740f-8cb1-c6c03e1326f8
- **Engine**: Added `getBlobsV4` endpoint
([#23767](paradigmxyz/reth#23767)).
- **RPC**: Narrowed `getLogs` retry range
([#23818](paradigmxyz/reth#23818)).
- **DB**: Skipped `move_to_static_files` for `storage.v2`
([#23814](paradigmxyz/reth#23814)).
- **Perf**: Prebound cursor operation metrics
([#23654](paradigmxyz/reth#23654)).
- **Execution**: Properly handle selfdestructed storage slots in
re-execute ([#23832](paradigmxyz/reth#23832)).
- **Deps**: Bumped alloy to 2.0.4
([#23828](paradigmxyz/reth#23828)); released
2.2.0 ([#23831](paradigmxyz/reth#23831)).

## Migrations

🔗 Amp thread:
https://ampcode.com/threads/T-019dd953-1036-7238-ad17-bc81e44fa2bd
- Bumped `reth` dependencies from rev `73ec2c9` to `88505c7` across all
`reth-*` crates in
[Cargo.toml](file:///home/runner/work/tempo/tempo/Cargo.toml) to track
the latest upstream Reth SDK revision.
- Bumped `alloy` family crates (`alloy`, `alloy-consensus`,
`alloy-contract`, `alloy-eips`, `alloy-genesis`, `alloy-network`,
`alloy-provider`, `alloy-rpc-types-*`, `alloy-serde`, `alloy-signer*`,
`alloy-transport`) from `2.0.1` to `2.0.4` to stay in sync with the new
Reth revision.
- Implemented the new `get_blobs_for_versioned_hashes_v4` method on
`TempoTransactionPool` in
[tempo_pool.rs](file:///home/runner/work/tempo/tempo/crates/transaction-pool/src/tempo_pool.rs#L1118-L1128),
delegating to the underlying `protocol_pool`, to satisfy the expanded
`BlobStore`/pool trait introduced upstream (adds an `indices_bitarray:
B128` parameter and returns `BlobCellsAndProofsV1` per hash).

[GitHub
Workflow](https://github.com/tempoxyz/tempo/actions/runs/25109971223)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants