B-Prod-P7: ForStRsOptions + FFM bindings for block cache + WBM tuning#7
Open
jackylee-ch wants to merge 1 commit into
Open
B-Prod-P7: ForStRsOptions + FFM bindings for block cache + WBM tuning#7jackylee-ch wants to merge 1 commit into
jackylee-ch wants to merge 1 commit into
Conversation
…lock cache + WBM tuning Java side of B-Prod-P7 (spec §6d). Mirrors the new Rust `FrsEngineOptions` repr(C) struct and the `frs_db_open_with_options` FFI added in the matching ForSt commit: - `ForStRsOptions`: 2 new fluent setters `blockCacheCapacityBytes(long)` (default 256 MiB) and `writeBufferManagerCapacityBytes(long)` (default 512 MiB). - `ForStRsLinker`: `FRS_ENGINE_OPTIONS_LAYOUT` (48-byte MemoryLayout.structLayout matching the Rust repr(C) field order with explicit 4-byte padding at +28), `dbOpenWithOptions(arena, path, writeBufferSize, maxWriteBufferNumber, maxBackgroundCompactions, maxBackgroundFlushes, blockCacheCapacityBytes, writeBufferManagerCapacityBytes)` Java method that allocates the struct in the caller's Arena and dispatches through `frs_db_open_with_options`. Plus 2 diagnostic getters (`dbWriteBufferManagerCapacity`, `dbWriteBufferManagerCurrentBytes`). ForStRsRuntimeTuningIT: 3 tests — options round-trip through FFI; default open uses spec §6d 512 MiB WBM cap; **read-latency bench under 256 MiB vs 1 GiB block cache, asserting P95 ratio meets the spec §6d 1.5x threshold**. Locally measured P95 ratios fluctuate between 1.50x–1.85x across runs; 1.50x exactly meets the spec floor. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ForStRsOptionsaddsblockCacheCapacityBytes(default 256 MiB) andwriteBufferManagerCapacityBytes(default 512 MiB) fluent setters with the same DoS-bound checks the engine validator enforces on the Rust side.ForStRsLinkerexposesFRS_ENGINE_OPTIONS_LAYOUT(48-byteMemoryLayout.structLayoutmatching Rust's#[repr(C)]field order with explicit 4-byte padding at +28) anddbOpenWithOptions(arena, path, writeBufferSize, maxWriteBufferNumber, maxBackgroundCompactions, maxBackgroundFlushes, blockCacheCapacityBytes, writeBufferManagerCapacityBytes)which allocates the struct in the caller'sArenaand dispatches throughfrs_db_open_with_options. Plus 2 diagnostic getters (dbWriteBufferManagerCapacity,dbWriteBufferManagerCurrentBytes).ForStRsRuntimeTuningIT— 3 tests: (1) options round-trip through FFI, (2) default open uses spec §6d 512 MiB WBM cap, (3) read-latency bench under 256 MiB vs 1 GiB block cache asserts the spec §6d P95 ratio ≥ 1.5x threshold (locally measured 1.50–1.85× across runs). Hard ceiling test rejects any wiring inversion (larger cache > 2× slower than smaller).Test plan
mvn test -Dtest=ForStRsRuntimeTuningIT— 3/3 pass (ratio 1.50–1.85× across runs)mvn test(full module) — 104/104 passFrsEngineOptionsrepr(C) struct +frs_db_open_with_optionsFFI +WriteBufferManagerengine wiring.🤖 Generated with Claude Code