Allow per-publication LadybugDB buffer-pool tuning #39
Labels
No labels
area/cli
area/core
area/database
area/indexing
area/query
type/epic
type/feature
type/foundation
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
JayKobe6k/ClariTree#39
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem and impact
ClariTree currently hard-codes a 4 GiB LadybugDB buffer pool for every database open. Publication workloads and user memory budgets differ, so one fixed cache limit cannot balance memory headroom, I/O, and throughput for every project. Users cannot currently lower the native cache allowance on constrained systems or raise it for deliberately provisioned indexing jobs.
This is an operational tuning control, not a promise that process RSS equals the selected pool size. Measurements below show substantial non-buffer-pool memory in LadybugDB publication.
Environment and workload
912603680dplus the uncommitted issue #38 streaming candidateBaseline and evidence
The fixed value is defined at src/persistence/ladybug.rs:44 and passed to every SystemConfig database open. Upstream documents buffer_pool_size as a byte-valued maximum controlling cached database pages: https://docs.rs/lbug/0.20.2/lbug/struct.SystemConfig.html#method.buffer_pool_size
Controlled candidate runs after plumbing a configurable value:
A 128 MiB pool reduced peak RSS by 129,788 KiB (2.2%) versus 4096 MiB at a 0.743 s (1.6%) persistence cost in these single runs. Values from 256 to 4096 MiB had effectively identical peak RSS, proving that the pool is not the dominant retained-memory source for this workload. The 64 MiB failure also proves that undersizing has a workload-dependent correctness/availability cost that must remain a visible typed database error.
Root cause
LadybugMetadataStore::open always constructs SystemConfig with one process-wide constant. IndexPersistenceConfiguration already carries the other per-publication memory and batching controls from both index new and index update, but it has no typed buffer-pool field.
Proposed implementation
Alternatives considered:
Expected benefit and risks
Acceptance criteria
Implementation candidate status (uncommitted)
The bounded 40-TU measurements and 64 MiB failure in the issue body remain the validation evidence. A follow-up 4-CPU-affinity experiment at 4096 MiB took 44.957 s persistence and still peaked at approximately 5.6 GiB, versus 47.739 s and approximately 5.6 GiB with all 16 CPUs. This did not identify thread-count tuning as a meaningful memory improvement, so no additional tuning issue is justified.
Implemented and pushed to
mainas654b2fbcf8e3ccc7ce7428b637d8b2736f67de19.Both
index newandindex updatenow expose the typed non-zero--database-buffer-pool-size-mibsetting, preserve the 4096 MiB compatibility default, and apply it to writable staging and read-only validation. CLI rejection/help, application defaults, publication behavior, documentation, full tests, rustdoc, and Windows cross-compilation passed through Nix.