[C API] Reuse slots freed by consolidate in svs_index_dynamic_add_points
維護者通常 5 天內回覆
還沒有人認領這個 Issue。
評估
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 新手友好度
- 55/100
- Issue 類型
- 缺陷
- 描述清晰度
- 描述清楚
- 活躍度
- 活躍
- 技術堆疊
- cpp
- 領域
- backend, performance
研究方向
Read include/svs/index/vamana/dynamic_index.h around add_points, consolidate, and the first_empty_ TODO, then trace the C API add path in bindings/c/src/index_vamana.cpp. Compare the proposed reuse approaches and check how they avoid an O(N) scan per add. Done means consolidated slots are reused through the C API without that per-add scan; review existing dynamic-index tests for coverage.
由索引模型根據 Issue 內容生成。
描述
Summary
Through the C API, slots freed by svs_index_dynamic_consolidate are never reused by svs_index_dynamic_add_points, so a dynamic index that sees deletes or updates keeps growing until it is compacted. Please make consolidated slots reusable by the C API's add path.
Details (at cde3771)
delete_entriesmarks slotsDeleted;consolidate()repairs the graph and turns themEmpty(include/svs/index/vamana/dynamic_index.h:1105-1108).add_pointslooks forEmptyslots starting atreuse_empty ? 0 : first_empty_(dynamic_index.h:772).first_empty_only moves up (:843) and is reset only bycompact()(:992). The constructor carries a TODO about this logic (:369-372).- The C++ orchestrator exposes
reuse_empty(include/svs/orchestrators/dynamic_vamana.h:80), but the C API'sDynamicIndexVamana::add_pointscallsindex.add_points(new_points, ids)without it (bindings/c/src/index_vamana.cpp:187), andsvs_index_dynamic_add_pointshas no way to request it.
So through the C API, consolidation repairs search but doesn't stop growth: every add after a delete appends a new slot.
Measured (valkey-search, ALGORITHM SVS_VAMANA)
2,000 vectors, DIM 128, then 100k updates (each a delete plus an add):
| Memory after churn | Search latency after churn | |
|---|---|---|
| No consolidation | 104 MiB (from 26 MiB) | 3.87 ms |
| Consolidate only | 104 MiB | 0.75 ms |
| Consolidate + compact | 26 MiB | 0.92 ms |
To bound memory we currently run svs_index_dynamic_compact after every consolidation. That copies every live vector and rewrites the graph, under an exclusive lock.
Ask
Let the C API's add path reuse slots that consolidation freed, without an O(N) scan per add. For example:
- Have
consolidate()lowerfirst_empty_to the first slot it freed, so the defaultadd_pointspath reuses them (this looks like what the TODO at:369-372is about); or - Expose
reuse_emptyin the C API (a parameter onsvs_index_dynamic_add_points, or a dynamic-index option). As implemented it rescans from slot 0 on every add, though, which would cost append-heavy workloads.
With either, valkey-search would consolidate only, and compact only when it wants memory back.
Consumer context
valkey-search builds SVS from the C API submodule, pinned at cde3771. The consolidate + compact workaround is eshenayo/valkey-search#24.
- 主要語言
- C++
- 星號
- 241
- 分支
- 48
- 平均合併
- 4 天 21 小時
- 30 天內合併 PR
- 11
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 沒有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
intel/ScalableVectorSearch 的其他 Issue
-
難度 1/5 1 小時以內 新手友好度 88/100
intel/ScalableVectorSearch#356 ·
維護者通常 5 天內回覆
-
難度 4/5 3-5 天 新手友好度 42/100
intel/ScalableVectorSearch#469 ·
維護者通常 5 天內回覆
-
enhancement
難度 3/5 1-2 天 新手友好度 32/100
intel/ScalableVectorSearch#460 ·
維護者通常 5 天內回覆
-
CI: tier the test matrix into PR / main / nightly to cut Actions minutes可能已有人在做 關聯的 PR 仍在進行中或已合併。 未關閉
難度 5/5 一週以上 新手友好度 32/100
intel/ScalableVectorSearch#432 · 1 則留言 ·
維護者通常 5 天內回覆
-
難度 3/5 1-2 天 新手友好度 45/100
intel/ScalableVectorSearch#427 ·
維護者通常 5 天內回覆
查看 intel/ScalableVectorSearch 的全部 Issue
相似的 Issue
-
runtime: lf_f128_mod is documented as fmodq (truncating) but implements floor-based modulo; unused未關閉internal correctness low priority rt_lib
難度 2/5 1-3 小時 新手友好度 72/100
維護者通常 1 天內回覆
-
難度 1/5 1 小時以內 新手友好度 87/100
-
PriorityNotificationQueue::wakeUpAll() loses the wake-up for a thread that is not waiting yet可能已有人在做 @matejk 今天認領。 未關閉bug
難度 2/5 1-3 小時 新手友好度 78/100
pocoproject/poco#5674 ·
維護者通常 2 天內回覆
-
bug docs GUI
難度 2/5 1-3 小時 新手友好度 62/100
sonic-pi-net/sonic-pi#3609 ·
-
bug
難度 2/5 1-3 小時 新手友好度 70/100
SanderMertens/flecs#2395 ·
維護者通常 1 天內回覆