OpenViking
OpenViking copied to clipboard
[Bug] Vector index loads entirely into RAM: 3.9 GB on-disk -> 21.5 GB RssAnon, OOMs a 30 GB host (3rd machine freeze)
Summary
Environment
| Item | Value |
|---|---|
| Version | openviking 0.5.0 (server, docker container, no memory limit) |
| Embedding | qwen3.7-text-embedding (Bailian), dim 1024, batch ≤20 |
| Host | Alibaba Cloud ECS, 30 GB RAM, 8 vCPU |
| Corpus | 112 git repos (≈92,000 files indexed), vectors_only mode, 62 exclude patterns |
| on-disk vectordb | 3.9 GB (data/vectordb/), resources tree 690 MB |
Symptom
After a full reimport of the corpus:
- Steady state (post-import, no queries): RSS ~20.8 GiB — already dangerously high for a 30 GB host.
- Restart + first query triggers full index load: RSS climbs at ~4 GB/min (23.2 → 25.5 → 28.25 GiB, CPU 100%).
- Host RAM exhausts → kernel OOM / user-space freeze: SSH + HTTP all dead, OOM killer does NOT reclaim (container has no memory limit; 3rd freeze incident on this machine since 10-13).
- RSS breakdown at steady state: RssAnon 21.5 GB / RssFile 2.4 GB — the 21.5 GB is genuine anonymous heap, not page cache. On-disk index 3.9 GB → in-RAM ≈ 5.5× expansion.
Timeline evidence (docker stats, 2026-10-17 CST):
restart done → 806 MiB
+ health/find call → 23.23 GiB (100% CPU)
+15s → 24.42 GiB
+20s → 25.14 GiB
+40s → 28.25 GiB
~01:31 → host unreachable (SSH/HTTP timeouts), stayed frozen >1h
Previous occurrences (same root shape):
- 2026-10-13: OOM killer killed openviking-server at anon-rss 30.26 GB.
- 2026-10-14: steady climb to 28.5 GB resident.
- 2026-10-16: delta-replay OOM loop (large dirty delta → replay eats all RAM; similar to #5064 but replay never completed).
Questions / requests
- Is there any config to keep the vector index on disk (mmap / disk-backed) instead of loading it fully into RAM? (
ov.confhas no such option that we can find in 0.5.0 docs.) - Why does a 3.9 GB on-disk index need ~21.5 GB anonymous RAM? (HNSW/LSH graph structures? int8/float32 copies? per-vector metadata?) Is 5.5× expansion expected?
- Is bounded-memory / streaming-index mode on the roadmap? For a 30 GB host, even a mid-size code corpus (112 repos) is unhostable today.
- Any recommended mitigations besides shrinking the corpus (more aggressive excludes)?
Workaround we are using meanwhile
- Staged reimport in small batches (10 repos) with RSS gates, abort if RSS > 22 GiB during import.
- Content diet: extend exclude patterns (dist/, minified bundles, images, lockfiles) and re-measure.
- Avoiding restart whenever possible — restart+first query is the most dangerous phase (full index load burst).
Related closed issues found: #5064 / #5221 / #5225 (delta replay bounded paging) — our issue is the steady-state load, not the replay.