Repository navigation
fix(#7146): size the HNSW build cache from the heap ceiling so served matches embedded - #7147
Conversation
… so served matches embedded graphBuildCacheMaxHeapPercent took a share of leftover heap, so a served ingest that already held the corpus chose a third of the cache an embedded build of the same corpus would get. Budget from -Xmx instead, cap at 90% of what is still free so online rebuilds still shrink, apply the percent to INT8/BINARY, and log size=N of corpus.
|
Tick the box to add this pull request to the merge queue (same as
|
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 0 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (4)
Included review availability: Your plan provides up to 8 included reviews per hour; 6 remain after this review. 📝 WalkthroughWalkthroughGraph-build cache sizing now uses a percentage of maximum heap, capped by 90% of available heap. The policy applies to document-backed and inline-quantized indexes. Graph builds reuse a warmed cache. Tests cover sizing, integration, and logging. ChangesVector graph-build cache budgeting
Estimated code review effort: 3 (Moderate) | ~25 minutes Merge Risk: ⚪ Minimal · up to Graph-build cache sizing now consistently uses the JVM heap ceiling with an available-heap cap, including INT8/BINARY indexes, while preserving bounded cache warming and cache-capacity logging. No merge-blocking current-head risk remains. Sequence Diagram(s)sequenceDiagram
participant LSMVectorIndex
participant VectorHeapBudget
participant JVM
participant ArcadePageVectorValues
LSMVectorIndex->>JVM: Release resident graph
LSMVectorIndex->>VectorHeapBudget: Calculate cache budget
VectorHeapBudget->>JVM: Read maximum and available heap
JVM-->>VectorHeapBudget: Return heap measurements
VectorHeapBudget-->>LSMVectorIndex: Return capped capacity
LSMVectorIndex->>LSMVectorIndex: Warm VectorCache
LSMVectorIndex->>ArcadePageVectorValues: Build graph with warmed cache
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
Comment |
|
@claude review this |
|
Claude finished @lvca's task in 2m 56s —— View job Claude's review
Note: the sandbox in this session declined the approval prompt for every SummaryThis is a tight, well-scoped fix. The core change: Correctness check on
|
…nputs Sizing the graph-build cache from the heap ceiling makes it scale with the corpus rather than with whatever heap happened to be free, which is the point of ArcadeData#7146 - but it also makes everything that scaled alongside the cache scale with the corpus too. The validation phase collected every vector it read into a HashMap<Integer, VectorFloat<?>> and copied that into the build cache afterwards, so both structures were live at the peak of the build: a boxed key, a map node and a table slot per cached vector, about 50 bytes each, on top of the cache entry that outlives them. That is ~500 MB on a ten-million vector build, spent at the exact moment the graph itself is about to be allocated, and it is not counted by bytesPerCachedVector() - so it was already outside the budget that is supposed to bound the build, and the bigger default now makes it proportional to the corpus. The cache is now built up front and warmed in place, and the intermediate map is gone. ArcadePageVectorValues gains a forGraphBuild() overload that takes the warmed cache; putInCache(), which existed only for the copy loop, goes with it. computeGraphBuildCacheCapacity() no longer reads its inlineQuantization argument, since the percent knob now applies to INT8/BINARY as well, so the argument is removed rather than left for a caller to believe in. How a miss is resolved is a property of the reader, not of the capacity. Two tests were pinned to figures that only hold on some machines. The live JVM overload was compared against a second reading of availableHeapBytes() taken in the test, which disagrees whenever a collection lands between the two - regularly, in a full-suite run; it now asserts the invariant that matters, the share of a ceiling that cannot move. And the "capped by the heap budget" assertions became -Xmx-dependent when the denominator changed: at 32 dimensions, 25% of the ceiling covers the 50M-vector probe on any host with 154 GB of RAM or more, so the cap is now made to bind explicitly rather than by luck. Adds a regression test that an INT8 build logs the same "cache enabled: size=N of N" line a document-backed one does, which is the form issue ArcadeData#7146 had to work backwards from. Issue ArcadeData#7146
|
Thanks @M-Tesla ! |
…che build check PROBE_WAIT_REBUILD=1 (bounded mode) waits for asyncRebuildInProgress to clear after the last step and takes one more timed pass, so a record shows the ArcadeData#6858 bound landing rather than only firing. cache_default_10m_check.py builds DEEP-10M once per precision at the default cache and records the engine's own 'cache enabled: size=M of N' line (ArcadeData#7146/ArcadeData#7147). Both are mechanism checks for the qCQ verification on upstream main, not page rows. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01JB6Hg77dQVqABoTJmiUnV2
…upstream main 9010582 Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01JB6Hg77dQVqABoTJmiUnV2
Fixes #7146
What does this PR do?
graphBuildCacheMaxHeapPercentnow takes its share of the JVM heap ceiling (-Xmx), then caps that at 90% of the heap currently available. A served ingest of the same corpus as an embedded build therefore gets the same cache at the default, instead of a third of it. The percent knob also applies to INT8/BINARY, and the INFO line iscache enabled: size=N of corpus.Motivation
On DEEP-10M the same jars built in 190 to 198 min served against 38 to 42 min embedded, with identical recall. Pinning
graphBuildCacheSizeshowed the two deployments are within 10% of each other at every matched cache capacity, so this is the default sizer, not the transport. The served arm had just ingested the corpus into the same heap, leftover was ~6.6 GB of 24 GB, and 25% of that leftover paid for 3.67 million of 9.99 million vectors. INT8 never read the percent knob at all:graphBuildCacheMaxHeapPercent=75still chose 100,000.Related issues
budgetBytes()(percent of leftover).Additional Notes
The search cache is unchanged: it still budgets from leftover heap. Only the graph-build cache moves to percent-of-ceiling, because that is the working set whose size should be an operator policy of
-Xmx, not of whatever happens to be live at the instant the build starts.Checklist
mvn clean packagecommandTargeted engine tests, all green:
Issue7146GraphBuildCacheBudgetTest,LSMVectorIndexBuildCacheSizingTest,Issue6503VectorHeapBudgetTest,Issue6503RebuildAdmissionControlTest,LowRamProfileTest.Summary by CodeRabbit
Bug Fixes
Tests