perf(storage): reduce temporary work in grouped Hash and Set writes - #228
thweetkomputer wants to merge 1 commit into
Conversation
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. Warning Review limit reachedNext included review available in 9 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (8)
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (8)
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review. WalkthroughThe changes add direct group lookup, revise directory replacement and grouped edit processing, and update mutation and physical-index paths. Tests cover directory batches, record relocation, and incremental index updates. ChangesGrouped Hash Update and Read Paths
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Refactor Merge Risk: ⚪ Minimal · up to The grouped Hash/Set optimizations have no established merge-blocking issue. Merge after normal build and test checks; runtime validation results supplied here are author-reported rather than independently reproduced. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The checked changes preserve identity validation, isolation and failure-handling controls. No introduced security weakness was established, but the available evidence does not support a complete assurance assessment. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. A rabbit checks each hash with care, Comment |
b6ed4df to
80792c4
Compare
80792c4 to
31f0988
Compare
Summary
Reduce temporary allocations and repeated metadata work in grouped Hash/Set point writes, based on perf samples of merged main
a6e93d3dwith 50,000 × 1 MiB Sets (128 B members).No value/page cache, durable-format change, admission bypass, or commit-notification change. Existing immutable snapshot ownership and corruption checks remain in place. No architecture claim changes.
Perf evidence and limits
All eight Hash/Set conditions now compare recovered main
a6e93d3dwith the current PR head80792c41, using paired datasets: 50,000 × 1 MiB keys and 500 × 100 MiB keys, each with 128 B and 1 KiB entries. Clean eight-second write points at 80–5,120 connections give:Separate 30-second write diagnostics (20 seconds sampled) support gains at higher connections. For example, Hash / 1 KiB at 1,280/5,120 connections is main 118,624/102,819 vs PR 136,227/117,466 QPS. Tail latency is variable; no uniform latency improvement is claimed. Kvrocks still has a substantial peak-throughput advantage on several write workloads. Peer durability/cache settings differ, as documented; no peer benchmarks were rerun.
Using all reported symbols at 1,280 connections, allocation/free self CPU shares decrease from 12.19% to 10.72% for Set / 128 B and 16.80% to 14.53% for Hash / 1 KiB. Active-group lookup drops from 2.01% to 0.19% and 2.43% to 0.93%. These are named-function CPU sample shares, not allocation counts or all inlined work. Physical-record lookup remains around 4–5%.
Read checks retain every lower point:
Hash / 100 MiB / 1 KiB HGET is about 23% / 20% below main at 1,280 / 2,560 connections in the short grid; these points are retained. On one fixed dataset, with no intervening writes or perf, three 30-second HGET repeats at 1,280 connections give main 417,998 / 417,250 / 441,911 versus PR 412,563 / 405,788 / 411,345 QPS. PR mean is still 3.7% lower, with zero errors and unchanged cardinalities. The approximately 20% gap did not recur, but these few sequential repetitions cannot rule out a smaller regression. No point-read improvement is claimed. Raw repeats and provenance.
Set / 128 B, three unprofiled 30-second SMEMBERS repetitions at 80 connections: main 1,966 / 1,967 / 1,945, PR 1,909 / 1,922 / 1,941 QPS (mean −1.8%).
Hash / 128 B HGETALL: main 1,830 / 1,815 / 1,797, PR 1,861 / 1,857 / 1,842, followed by main again on the same dataset 1,842 / 1,838 / 1,842 QPS. PR / return-main mean is 1.007×. The earlier short-run drop was not established as a stable regression.
Separate HGETALL profiles show the same memory-copy and vector-append hotspots in both versions; these existing costs are not removed by this write-focused change. Single-run connection grids and three-repeat sequential checks do not provide confidence intervals.
All 200 clean connection-grid points have zero errors and every key is validated before/after. Eight conditions and all 16 chart files are published. Per-point ratios and database peaks are inspectable alongside the source/binary manifest.
The 100 MiB Set / 128 B, 16-connection SMEMBERS short point was lower, so longer checks were added. Main returned
OOM grouped operation scratch admissionin its third repetition and PR returned the same error in its second. Neither process crashed; both closed normally afterward. The worker-local scratch gate and approximately 1.2 GiB reservation per full read are unchanged by this PR. Both failed sustained-read runs are disclosed beside the eight-second plot and excluded from aggregate throughput comparisons. Zero errors in the short grids does not establish sustained-read stability.Embedded main/PR graphs, CPU evidence and raw results. Exact source/binary provenance and reproducible profiling/full-read scripts are included. Main grids and separate diagnostics remain distinct. The short grids run reads then writes for main followed by PR, so intervening writes can change physical layout; the extra read-only checks explicitly avoid those writes.
Validation
Compilation completed before any tests or benchmarks ran.
Added directory coverage/snapshot regression coverage for mixed replacement/split batches, missing retirements, duplicate mutations and invalid aggregate counts.
The physical-index tests also verify untouched coordinates and retired prefix ancestors across the copied page and preserve old snapshots.
Summary by CodeRabbit
Performance Improvements
Bug Fixes