Skip to content

Reduce default registered read payload to 32 KiB - #302

Merged
thweetkomputer merged 7 commits into
mainfrom
perf/read-slots-32k-20261009
Oct 9, 2026
Merged

thweetkomputer merged 7 commits into
mainfrom
perf/read-slots-32k-20261009

Conversation

@thweetkomputer

@thweetkomputer thweetkomputer commented Oct 9, 2026 •

Copy link
Copy Markdown
Collaborator

Context

Ordinary compact records and grouped reads do not need the existing 1 MiB default registered read payload. Reduce it to 32 KiB, retaining the existing oversized-read path. This is a draft because the measured SET difference is unresolved; it is not a demonstrated regression-free optimization.

Includes merged Bycorf PR eloqdata/bycorf#9, pinned to its main-branch commit 85d8c9c9e5372da79fbc41fbe9da71e34bb6ba24. The merged tree matches the previously validated dependency tree. Smaller slots allow more ordinary reads to reach SPDK before the registered pool applies backpressure, exposing a pre-existing qpair descriptor-exhaustion error. The runtime correctness fix is independently reviewable there.

Behavior before and after

  • Default read payload: 1 MiB → 32 KiB in server and storage pool options. Explicit --storage-read-buffer-kb=1024 restores the old slot size.
  • Ordinary reads still wait for a bounded reusable slot. Oversized records still use the existing aligned overflow path. 16 KiB is not a hard limit on stored record size.
  • The benchmark's 256 MiB/worker registered budget provides 222 → 5,734 read slots. The product's 64 MiB default budget is unchanged; it was not separately throughput-tested here.

Three alternating native-SPDK sessions per variant, 640 memtier connections, 1 KiB values, 1B existing keys, defrag enabled:

Command Original runtime / 1 MiB Fixed runtime / 32 KiB Median change
GET 939,694 QPS 940,702 QPS +0.11%
SET 725,675 QPS 710,871 QPS −2.04%

The primary comparison changes both runtime and slot size. Supplemental fixed-runtime/1 MiB measurements are near the baseline, but use a different sampling sequence and cannot conclusively attribute the SET difference.

Implementation

Change two defaults and correct a stale direct-read comment. Pin Bycorf to the deferred-submission fix with compact 48-byte request metadata. Initial submission reuses its already-resolved namespace/qpair; only deferred retries resolve the saved fixed-file index. Completion ownership comes from the existing worker TLS, with no per-request backend pointer or additional polling context. Add the bilingual benchmark report, original outputs, checksums and diagnostic evidence under perf_reports/lavik-read-slots-32k-2026-10-09/.

Design decisions and alternatives

32 KiB leaves room around common compact/grouped records without asserting a universal 16 KiB bound. Preserve explicit configuration and existing overflow handling.

Diagnostic scheduler tracing explains why fixed global concurrency can still exhaust one qpair: other workers continue returning requests while one owner is preempted, concentrating pending work there. Five workers' first captured pressure episodes show eight long polling gaps with 95.7–99.4% off-CPU time. Both diagnostic configurations have consistent completion accounting and local block-owner routing. These traces explain a saturation mechanism; they neither reconstruct every original error nor establish the SET slowdown's cause. Instrumented QPS is excluded from the performance comparison.

Documentation and comments

Update nearby capacity comments and the performance-report index. This default-size tuning changes no Lavik architecture claim, disk format or ownership model. Bycorf's queue lifetime/flow documentation is updated in the dependency PR. Temporary tracing code is not included in either PR.

Test plan

The Bycorf dependency also includes bycorf_spdk_backpressure_stub_check, registered in its bypass CTest jobs. It exercises the actual backend with link-time device stubs and requires no SPDK hardware or hugepages. Local Clang 18 Debug and GCC 13 Release runs pass; disabling ENOMEM deferral makes the regression fail as expected. This adds CI correctness coverage without additional performance runs.

Passed on the test host (build directory: /mnt/dev/peer-bench/read-slots-32k-2026-10-09/build):

./build/lavik_unit_tests --gtest_filter='BufferPoolTest.*:ConfigTest.*'
./build/lavik_unit_tests --gtest_filter='RedisConfigTest.*'
./build/lavik_grouped_ordered_write_e2e_test --gtest_filter='GroupedStringWriteE2e.FixedSegmentsPointWritesTtlAndRecovery:GroupedStringWriteE2e.LongKeysPromoteAndRecover:GroupedDemotionE2e.StringListSetSortedSetGeoAndStreamRecoverCompact'
pre-commit run --files include/lavik/server.h include/lavik/storage/buffer_pool.h src/storage/engine/read.cpp

36 unit checks and three grouped E2E cases passed. The archived protocol runner verifies strings through 2 MiB, large collection elements, long keys and restart recovery with both io_uring and SPDK. Native-SPDK test keys in DB 15 were deleted afterward; DB 0 remains at 1B keys. All 12 primary and six supplemental throughput points have no client errors; GETs have no misses.

The latest compact-metadata build and runtime hardware regression check pass four deterministic descriptor-exhaustion bursts; old runtime fails as expected. The earlier traced 32 KiB run (before metadata compaction) recovers all 138 initial transient submission failures. Both diagnostic sessions drain all accepted operations and exit cleanly. NVMe drivers, hugepages and unsafe no-IOMMU are restored. Raw commands, build flags, outputs and hashes for the original comparison are in the report archives. The layout-only runtime follow-up has no completed throughput comparison; its Release/SPDK build and hardware correctness check passed, including an accepted read completed by shutdown under the owning worker context.

Risk assessment

The smaller payload changes slot count and the point at which reads wait. The SET median is 2.04% lower in the primary comparison; do not merge this draft as a validated no-regression change. Default 64 MiB-budget throughput also remains unmeasured.

Rollback plan

Set --storage-read-buffer-kb=1024 or revert the default-size change. The independent Bycorf correctness fix can remain. No data reload or disk-format rollback is required.

Reviewer guide

Review defaults and the dependency pin first, then the report's methodology and limitations. Review the runtime implementation in Bycorf PR #9. The evidence archives contain temporary diagnostic patches for reproducibility, not production code.

Follow-up work

Resolve the SET difference with a matched single-variable experiment before taking this PR out of draft.

@coderabbitai

coderabbitai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 51 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e273bb3e-5742-45b5-bd6c-1ee3739dd418

📥 Commits

Reviewing files that changed from the base of the PR and between 8004981 and 214dfde.


⛔ Files ignored due to path filters (3)
  • perf_reports/lavik-read-slots-32k-2026-10-09/debug-evidence.tar.gz is excluded by !**/*.gz
  • perf_reports/lavik-read-slots-32k-2026-10-09/evidence.tar.gz is excluded by !**/*.gz
  • perf_reports/lavik-read-slots-32k-2026-10-09/results.csv is excluded by !**/*.csv

📒 Files selected for processing (15)
  • bycorf
  • include/lavik/server.h
  • include/lavik/storage/buffer_pool.h
  • perf_reports/README.md
  • perf_reports/lavik-read-slots-32k-2026-10-09/README.md
  • perf_reports/lavik-read-slots-32k-2026-10-09/README.zh-CN.md
  • perf_reports/lavik-read-slots-32k-2026-10-09/SHA256SUMS
  • perf_reports/lavik-read-slots-32k-2026-10-09/build-manifest.json
  • perf_reports/lavik-read-slots-32k-2026-10-09/correctness-complete.json
  • perf_reports/lavik-read-slots-32k-2026-10-09/host-restored.json
  • perf_reports/lavik-read-slots-32k-2026-10-09/read-slots-32k.patch
  • perf_reports/lavik-read-slots-32k-2026-10-09/spdk-backpressure.patch
  • perf_reports/lavik-read-slots-32k-2026-10-09/summary.json
  • perf_reports/lavik-read-slots-32k-2026-10-09/supplemental.json
  • src/storage/engine/read.cpp


  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@thweetkomputer
thweetkomputer marked this pull request as ready for review October 9, 2026 10:08
@thweetkomputer
thweetkomputer merged commit 874c882 into main Oct 9, 2026
6 checks passed
@thweetkomputer
thweetkomputer deleted the perf/read-slots-32k-20261009 branch October 9, 2026 10:08
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.

1 participant