Skip to content

B-Prod-P7: ForStRsOptions + FFM bindings for block cache + WBM tuning#7

Open
jackylee-ch wants to merge 1 commit into
b-prod-p6-remote-storagefrom
b-prod-p7-tuning
Open

B-Prod-P7: ForStRsOptions + FFM bindings for block cache + WBM tuning#7
jackylee-ch wants to merge 1 commit into
b-prod-p6-remote-storagefrom
b-prod-p7-tuning

Conversation

@jackylee-ch

Copy link
Copy Markdown
Owner

Summary

  • Spec §6d Java surface. ForStRsOptions adds blockCacheCapacityBytes (default 256 MiB) and writeBufferManagerCapacityBytes (default 512 MiB) fluent setters with the same DoS-bound checks the engine validator enforces on the Rust side.
  • FFM struct binding. ForStRsLinker exposes FRS_ENGINE_OPTIONS_LAYOUT (48-byte MemoryLayout.structLayout matching Rust's #[repr(C)] field order with explicit 4-byte padding at +28) and dbOpenWithOptions(arena, path, writeBufferSize, maxWriteBufferNumber, maxBackgroundCompactions, maxBackgroundFlushes, blockCacheCapacityBytes, writeBufferManagerCapacityBytes) which 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: (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 pass
  • Companion ForSt PR (jackylee-ch/ForSt#4) ships the matching FrsEngineOptions repr(C) struct + frs_db_open_with_options FFI + WriteBufferManager engine wiring.

🤖 Generated with Claude Code

…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>
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