Skip to content

Benchmarks: Sweep accdb Cache Footprint and Min Reserved - #11437

Open
MilanSuri wants to merge 4 commits into
firedancer-io:mainfrom
MilanSuri:accdb_cache_disk_bench_ms
Open

Benchmarks: Sweep accdb Cache Footprint and Min Reserved#11437
MilanSuri wants to merge 4 commits into
firedancer-io:mainfrom
MilanSuri:accdb_cache_disk_bench_ms

Conversation

@MilanSuri

Copy link
Copy Markdown
Contributor

Added benchmarks to sweep:

  • accdb cache footprint
  • accdb min reserved

Used to investigate memory/performance tradeoffs in different cache configs.

Output of the Sweeps:

NOTICE  09-12 02:33:10.981122 0         bench_accdb.c(562): --- cache sweep ---
NOTICE  09-12 02:33:10.981156 0         bench_accdb.c(572): --- cache sweep @ 7 GiB ---
NOTICE  09-12 02:33:14.299312 0         bench_accdb.c(415): bench_replay: 1000 slots, 4800 reads/slot, 1200 writes/slot, 3.311 s total
NOTICE  09-12 02:33:14.299349 0         bench_accdb.c(421):   read:    4800000 queries (1765904 hits, 36.8% hit rate), 2524603 reads/s, 396 ns/read
NOTICE  09-12 02:33:14.299356 0         bench_accdb.c(427):   write:   1200000 writes, 158.01 MiB, 923660 writes/s, 1083 ns/write
NOTICE  09-12 02:33:14.299359 0         bench_accdb.c(432):   root:    110159 ns/root, 0.110 s total (999 slots rooted)
NOTICE  09-12 02:33:14.299362 0         bench_accdb.c(435):   slot:    3310581 ns/slot (302 slots/s)
NOTICE  09-12 02:33:14.299364 0         bench_accdb.c(440):   metrics: accounts_total=759245 disk_used=149.47 MiB disk_alloc=1024.00 MiB
NOTICE  09-12 02:33:14.347193 0         bench_accdb.c(572): --- cache sweep @ 8 GiB ---
NOTICE  09-12 02:33:16.681598 0         bench_accdb.c(415): bench_replay: 1000 slots, 4800 reads/slot, 1200 writes/slot, 2.181 s total
NOTICE  09-12 02:33:16.681635 0         bench_accdb.c(421):   read:    4800000 queries (1765904 hits, 36.8% hit rate), 4081833 reads/s, 245 ns/read
NOTICE  09-12 02:33:16.681642 0         bench_accdb.c(427):   write:   1200000 writes, 158.01 MiB, 1291957 writes/s, 774 ns/write
NOTICE  09-12 02:33:16.681645 0         bench_accdb.c(432):   root:    76315 ns/root, 0.076 s total (999 slots rooted)
NOTICE  09-12 02:33:16.681648 0         bench_accdb.c(435):   slot:    2181053 ns/slot (458 slots/s)
NOTICE  09-12 02:33:16.681650 0         bench_accdb.c(440):   metrics: accounts_total=759245 disk_used=29.00 MiB disk_alloc=1024.00 MiB
NOTICE  09-12 02:33:16.746601 0         bench_accdb.c(572): --- cache sweep @ 10 GiB ---
NOTICE  09-12 02:33:19.094274 0         bench_accdb.c(415): bench_replay: 1000 slots, 4800 reads/slot, 1200 writes/slot, 1.899 s total
NOTICE  09-12 02:33:19.094312 0         bench_accdb.c(421):   read:    4800000 queries (1765904 hits, 36.8% hit rate), 4356665 reads/s, 230 ns/read
NOTICE  09-12 02:33:19.094318 0         bench_accdb.c(427):   write:   1200000 writes, 158.01 MiB, 1636319 writes/s, 611 ns/write
NOTICE  09-12 02:33:19.094322 0         bench_accdb.c(432):   root:    63618 ns/root, 0.064 s total (999 slots rooted)
NOTICE  09-12 02:33:19.094325 0         bench_accdb.c(435):   slot:    1898714 ns/slot (527 slots/s)
NOTICE  09-12 02:33:19.094327 0         bench_accdb.c(440):   metrics: accounts_total=759245 disk_used=0.00 MiB disk_alloc=0.00 MiB
NOTICE  09-12 02:33:19.154933 0         bench_accdb.c(572): --- cache sweep @ 12 GiB ---
NOTICE  09-12 02:33:21.725951 0         bench_accdb.c(415): bench_replay: 1000 slots, 4800 reads/slot, 1200 writes/slot, 1.817 s total
NOTICE  09-12 02:33:21.725991 0         bench_accdb.c(421):   read:    4800000 queries (1765904 hits, 36.8% hit rate), 4668007 reads/s, 214 ns/read
NOTICE  09-12 02:33:21.725998 0         bench_accdb.c(427):   write:   1200000 writes, 158.01 MiB, 1660220 writes/s, 602 ns/write
NOTICE  09-12 02:33:21.726001 0         bench_accdb.c(432):   root:    66182 ns/root, 0.066 s total (999 slots rooted)
NOTICE  09-12 02:33:21.726011 0         bench_accdb.c(435):   slot:    1817229 ns/slot (550 slots/s)
NOTICE  09-12 02:33:21.726014 0         bench_accdb.c(440):   metrics: accounts_total=759245 disk_used=0.00 MiB disk_alloc=0.00 MiB
NOTICE  09-12 02:33:21.820239 0         bench_accdb.c(572): --- cache sweep @ 16 GiB ---
NOTICE  09-12 02:33:25.022690 0         bench_accdb.c(415): bench_replay: 1000 slots, 4800 reads/slot, 1200 writes/slot, 1.856 s total
NOTICE  09-12 02:33:25.022744 0         bench_accdb.c(421):   read:    4800000 queries (1765904 hits, 36.8% hit rate), 4492028 reads/s, 223 ns/read
NOTICE  09-12 02:33:25.022752 0         bench_accdb.c(427):   write:   1200000 writes, 158.01 MiB, 1659998 writes/s, 602 ns/write
NOTICE  09-12 02:33:25.022755 0         bench_accdb.c(432):   root:    65002 ns/root, 0.065 s total (999 slots rooted)
NOTICE  09-12 02:33:25.022761 0         bench_accdb.c(435):   slot:    1856431 ns/slot (539 slots/s)
NOTICE  09-12 02:33:25.022764 0         bench_accdb.c(440):   metrics: accounts_total=759245 disk_used=0.00 MiB disk_alloc=0.00 MiB
NOTICE  09-12 02:33:25.185805 0         bench_accdb.c(578): --- cache min reserved sweep ---
NOTICE  09-12 02:33:25.185846 0         bench_accdb.c(588): --- cache min reserved sweep @ 160 ---
NOTICE  09-12 02:33:27.634844 0         bench_accdb.c(415): bench_replay: 1000 slots, 4800 reads/slot, 1200 writes/slot, 1.860 s total
NOTICE  09-12 02:33:27.634885 0         bench_accdb.c(421):   read:    4800000 queries (1765904 hits, 36.8% hit rate), 4495643 reads/s, 222 ns/read
NOTICE  09-12 02:33:27.634895 0         bench_accdb.c(427):   write:   1200000 writes, 158.01 MiB, 1659976 writes/s, 602 ns/write
NOTICE  09-12 02:33:27.634898 0         bench_accdb.c(432):   root:    69689 ns/root, 0.070 s total (999 slots rooted)
NOTICE  09-12 02:33:27.634900 0         bench_accdb.c(435):   slot:    1860261 ns/slot (538 slots/s)
NOTICE  09-12 02:33:27.634903 0         bench_accdb.c(440):   metrics: accounts_total=759245 disk_used=0.00 MiB disk_alloc=0.00 MiB
NOTICE  09-12 02:33:27.710605 0         bench_accdb.c(588): --- cache min reserved sweep @ 320 ---
NOTICE  09-12 02:33:30.146173 0         bench_accdb.c(415): bench_replay: 1000 slots, 4800 reads/slot, 1200 writes/slot, 1.846 s total
NOTICE  09-12 02:33:30.146220 0         bench_accdb.c(421):   read:    4800000 queries (1765904 hits, 36.8% hit rate), 4508889 reads/s, 222 ns/read
NOTICE  09-12 02:33:30.146227 0         bench_accdb.c(427):   write:   1200000 writes, 158.01 MiB, 1672347 writes/s, 598 ns/write
NOTICE  09-12 02:33:30.146230 0         bench_accdb.c(432):   root:    64144 ns/root, 0.064 s total (999 slots rooted)
NOTICE  09-12 02:33:30.146233 0         bench_accdb.c(435):   slot:    1846236 ns/slot (542 slots/s)
NOTICE  09-12 02:33:30.146235 0         bench_accdb.c(440):   metrics: accounts_total=759245 disk_used=0.00 MiB disk_alloc=0.00 MiB
NOTICE  09-12 02:33:30.222174 0         bench_accdb.c(588): --- cache min reserved sweep @ 480 ---
NOTICE  09-12 02:33:32.697378 0         bench_accdb.c(415): bench_replay: 1000 slots, 4800 reads/slot, 1200 writes/slot, 1.887 s total
NOTICE  09-12 02:33:32.697416 0         bench_accdb.c(421):   read:    4800000 queries (1765904 hits, 36.8% hit rate), 4422243 reads/s, 226 ns/read
NOTICE  09-12 02:33:32.697423 0         bench_accdb.c(427):   write:   1200000 writes, 158.01 MiB, 1651198 writes/s, 606 ns/write
NOTICE  09-12 02:33:32.697426 0         bench_accdb.c(432):   root:    74471 ns/root, 0.074 s total (999 slots rooted)
NOTICE  09-12 02:33:32.697429 0         bench_accdb.c(435):   slot:    1886603 ns/slot (530 slots/s)
NOTICE  09-12 02:33:32.697431 0         bench_accdb.c(440):   metrics: accounts_total=759245 disk_used=0.00 MiB disk_alloc=0.00 MiB
NOTICE  09-12 02:33:32.772827 0         bench_accdb.c(588): --- cache min reserved sweep @ 640 ---
NOTICE  09-12 02:33:35.067687 0         bench_accdb.c(415): bench_replay: 1000 slots, 4800 reads/slot, 1200 writes/slot, 1.849 s total
NOTICE  09-12 02:33:35.067731 0         bench_accdb.c(421):   read:    4800000 queries (1765904 hits, 36.8% hit rate), 4524774 reads/s, 221 ns/read
NOTICE  09-12 02:33:35.067738 0         bench_accdb.c(427):   write:   1200000 writes, 158.01 MiB, 1658440 writes/s, 603 ns/write
NOTICE  09-12 02:33:35.067749 0         bench_accdb.c(432):   root:    64649 ns/root, 0.065 s total (999 slots rooted)
NOTICE  09-12 02:33:35.067753 0         bench_accdb.c(435):   slot:    1849022 ns/slot (541 slots/s)
NOTICE  09-12 02:33:35.067756 0         bench_accdb.c(440):   metrics: accounts_total=759245 disk_used=0.00 MiB disk_alloc=0.00 MiB
NOTICE  09-12 02:33:35.133491 0         bench_accdb.c(588): --- cache min reserved sweep @ 800 ---
NOTICE  09-12 02:33:37.187148 0         bench_accdb.c(415): bench_replay: 1000 slots, 4800 reads/slot, 1200 writes/slot, 1.857 s total
NOTICE  09-12 02:33:37.187188 0         bench_accdb.c(421):   read:    4800000 queries (1765904 hits, 36.8% hit rate), 4508442 reads/s, 222 ns/read
NOTICE  09-12 02:33:37.187195 0         bench_accdb.c(427):   write:   1200000 writes, 158.01 MiB, 1651760 writes/s, 605 ns/write
NOTICE  09-12 02:33:37.187198 0         bench_accdb.c(432):   root:    66056 ns/root, 0.066 s total (999 slots rooted)
NOTICE  09-12 02:33:37.187201 0         bench_accdb.c(435):   slot:    1857197 ns/slot (538 slots/s)
NOTICE  09-12 02:33:37.187203 0         bench_accdb.c(440):   metrics: accounts_total=759245 disk_used=0.00 MiB disk_alloc=0.00 MiB

Note

I think the hit rate is being calculated incorrectly but wasn't sure if you had any recommendations for correcting how it's calculated.

Copilot AI balanced review requested due to automatic review settings September 12, 2026 06:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The benchmark must distinguish cache hits from accounts found.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Adds configurable accdb benchmark setup and replay sweeps for cache footprint and minimum-reserved settings.

Changes:

  • Parameterizes cache and replay configuration.
  • Adds cache footprint and minimum-reserved sweeps.
  • Cleans up benchmark allocations between runs.
File summaries
File Summary Review
src/flamenco/accdb/bench_accdb.c Implements configurable benchmark setup and cache sweeps. The 36.8% metric reports accounts found, not cache hits; instrument cache source or rename the metric. Moderate, 3 votes.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 1
  • Review effort level: Lite (auto)

Note

Copilot is running an experiment and ran this review at Lite.


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

tombstone (realistic for hot accounts like token program,
system program, fee payers, etc.). */
ulong pubkey_pool_sz = writes_per_slot * 4UL;
ulong pubkey_pool_sz = writes_per_slot * slot_cnt;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah I found this issue as well, I changed the pubkey_pool_sz from writes_per_slot * 4UL to being writes_per_slot * slot_cnt because I needed a way of increasing cache pressure for each sweep.

Is there a way to get the true cache hit rate in the Firedancer codebase or would it be better to just rename it to like found rate?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants