Skip to content

page_cache: one shard per root child so merkle update tasks balance across workers - #978

Merged
rphmeier merged 1 commit into
thrumdev:masterfrom
citizen-stig:nikolai/page-cache-shard-per-root-child
Nov 17, 2026
Merged

rphmeier merged 1 commit into
thrumdev:masterfrom
citizen-stig:nikolai/page-cache-shard-per-root-child

Conversation

@citizen-stig

Copy link
Copy Markdown
Contributor

What

PageCache now always has 64 shards, one per child of the root page, instead of commit_concurrency shards. The total cache size is unchanged.

Why

Each shard is one merkle update task on the commit_concurrency-thread pool. With one shard per thread, finish waits for the slowest key range, and threads that finish early sit idle. With 64 smaller tasks, idle threads pick up the remaining ones, so the load balances itself.

Benchmarks

master this PR Δ
finish_bench mean finish, 8 runs 122.34 ± 1.14 ms 113.11 ± 1.12 ms −7.5%
benchtop transfer, commit_concurrency 4: commit_and_prove 237.5 ms 199.5 ms −16%
… throughput 66.4k ops/s 76.4k ops/s +15%
benchtop transfer, commit_concurrency 1: commit_and_prove 546.5 ms 487.0 ms −11%

An earlier 5-run round gave the same finish result (123.0 → 113.3 ms). into_overlay is unchanged.

finish_bench: an isolated Session::finish benchmark with the user-namespace access profile of a Sovereign SDK node (benchtop/src/bin/finish_bench.rs @ 3469d5c, not part of this PR). 50k–145k ReadThenWrite accesses per slot (68% updates with the prior value, 32% inserts), 36-byte values, BinaryHasher<Sha256>, rollback on, commit_concurrency 6, tree growing from 5.35M to 6.26M leaves, 10 warm-up + 20 measured slots from a restored seed DB. AMD Ryzen 7 7700, pinned to 12 threads, base and branch runs interleaved. Every run ends at the same root. benchtop transfer: -c 22 -s 20000 --commit-concurrency 4 --op-limit 3000000, 4 interleaved runs on one DB copy (noisy: master commit_and_prove sd ≈ 9 ms).

🤖 Generated with Claude Code

…cross workers

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@citizen-stig
citizen-stig marked this pull request as ready for review November 17, 2026 08:27
@rphmeier
rphmeier merged commit 12435fe into thrumdev:master Nov 17, 2026
6 of 7 checks passed
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.

3 participants