Skip to content

Commit 981e2e4

Browse files
committed
feat(vector): Add per-index cache and rebuild parameters to create_vector_index
1 parent f103668 commit 981e2e4

6 files changed

Lines changed: 102 additions & 35 deletions

File tree

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# ArcadeDB MSMARCO MSMARCO-100K (1000 queries, Recall@50)
2+
3+
| quantization | store_vectors_in_graph | add_hierarchy | max_connections | beam_width | overquery_factor | batch_size | load_corpus_s | load_corpus_rss_mb | ingest_s | ingest_rss_mb | create_index_s | create_index_rss_mb | build_graph_now_s | build_graph_now_rss_mb | warmup_s | warmup_rss_mb | search_s | search_rss_mb | recall@50_before_close | close_db_s | close_db_rss_mb | open_db_s | open_db_rss_mb | warmup_after_reopen_s | warmup_after_reopen_rss_mb | search_after_reopen_s | search_after_reopen_rss_mb | recall@50_after_reopen | peak_rss_mb | db_size_mb | total_duration |
4+
|:---------------|:-------------------------|:----------------|------------------:|-------------:|-------------------:|-------------:|----------------:|---------------------:|-----------:|----------------:|-----------------:|----------------------:|--------------------:|-------------------------:|-----------:|----------------:|-----------:|----------------:|-------------------------:|-------------:|------------------:|------------:|-----------------:|------------------------:|-----------------------------:|------------------------:|-----------------------------:|-------------------------:|--------------:|-------------:|:-----------------|
5+
| INT8 | False | True | 16 | 100 | 16 | 10000 | nan | nan | nan | nan | nan | nan | nan | nan | 0.415 | 0.027 | 38.542 | 30.965 | 0.9962 | nan | nan | 0.235 | 0.129 | nan | nan | nan | nan | 0.9962 | 2915.16 | 676.01 | 39.232s |
6+
| INT8 | False | True | 16 | 100 | 8 | 10000 | nan | nan | nan | nan | nan | nan | nan | nan | 0.526 | 429.035 | 21.555 | -475.16 | 0.9954 | nan | nan | 0.195 | 0.125 | nan | nan | nan | nan | 0.9954 | 3359.32 | 676.01 | 22.295s |
7+
| INT8 | False | True | 16 | 100 | 4 | 10000 | nan | nan | nan | nan | nan | nan | nan | nan | 0.508 | 324.652 | 11.812 | -75.754 | 0.9934 | nan | nan | 0.193 | 0.129 | nan | nan | nan | nan | 0.9934 | 3006.03 | 676.01 | 12.530s |
8+
| INT8 | False | True | 16 | 100 | 2 | 10000 | nan | nan | nan | nan | nan | nan | nan | nan | 0.466 | 6.16 | 6.262 | 23.352 | 0.989 | nan | nan | 0.476 | 511.82 | nan | nan | nan | nan | 0.989 | 2680.88 | 676.01 | 7.221s |
9+
| INT8 | False | True | 16 | 100 | 1 | 10000 | 0 | 0 | 6.709 | 1349.74 | 1.594 | 114.453 | 48.844 | 768.883 | 0.02 | 13.492 | 2.147 | 92.324 | 0.9742 | 0.016 | -0.117 | 0.355 | 390.02 | 0.168 | 7.176 | 2.127 | 24.59 | 0.9742 | 2981.72 | 676.004 | 1m 2.598s |
10+
| INT8 | False | True | 16 | 100 | 1 | 10000 | nan | nan | nan | nan | nan | nan | nan | nan | 0.785 | 162.453 | 5.069 | 946.727 | 0.9742 | nan | nan | 1.905 | 980.359 | nan | nan | nan | nan | 0.9742 | 2139.41 | 676.01 | 8.056s |

bindings/python/examples/benchmark-vector/summaries/arcadedb_msmarco_MSMARCO-1M.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
| quantization | store_vectors_in_graph | add_hierarchy | max_connections | beam_width | overquery_factor | batch_size | load_corpus_s | load_corpus_rss_mb | ingest_s | ingest_rss_mb | create_index_s | create_index_rss_mb | build_graph_now_s | build_graph_now_rss_mb | warmup_s | warmup_rss_mb | search_s | search_rss_mb | recall@50_before_close | close_db_s | close_db_rss_mb | open_db_s | open_db_rss_mb | warmup_after_reopen_s | warmup_after_reopen_rss_mb | search_after_reopen_s | search_after_reopen_rss_mb | recall@50_after_reopen | peak_rss_mb | db_size_mb | total_duration |
44
|:---------------|:-------------------------|:----------------|------------------:|-------------:|-------------------:|-------------:|----------------:|---------------------:|-----------:|----------------:|-----------------:|----------------------:|--------------------:|-------------------------:|-----------:|----------------:|-----------:|----------------:|-------------------------:|-------------:|------------------:|------------:|-----------------:|------------------------:|-----------------------------:|------------------------:|-----------------------------:|-------------------------:|--------------:|-------------:|:-----------------|
5-
| INT8 | False | True | 16 | 100 | 16 | 10000 | nan | nan | nan | nan | nan | nan | nan | nan | 5.286 | 96.844 | 280.916 | 527.082 | 0.9919 | nan | nan | 13.161 | -587.992 | nan | nan | nan | nan | 0.9919 | 4531.02 | 6753.95 | 4m 59.383s |
6-
| INT8 | False | True | 16 | 100 | 8 | 10000 | nan | nan | nan | nan | nan | nan | nan | nan | 4.684 | 108.918 | 155.385 | 1372.14 | 0.9902 | nan | nan | 13.928 | -1467.46 | nan | nan | nan | nan | 0.9902 | 4495.21 | 6753.95 | 2m 54.082s |
7-
| INT8 | False | True | 16 | 100 | 4 | 10000 | nan | nan | nan | nan | nan | nan | nan | nan | 4.245 | -489.414 | 96.178 | 499.09 | 0.9835 | nan | nan | 13.074 | 2.664 | nan | nan | nan | nan | 0.9835 | 4477.92 | 6753.95 | 1m 53.536s |
8-
| INT8 | False | True | 16 | 100 | 2 | 10000 | nan | nan | nan | nan | nan | nan | nan | nan | 4.803 | 268.02 | 56.095 | 1095.62 | 0.9758 | nan | nan | 14.603 | -1306.14 | nan | nan | nan | nan | 0.9758 | 4465.29 | 6753.95 | 1m 15.537s |
9-
| INT8 | False | True | 16 | 100 | 1 | 10000 | 0 | 0 | 93.5 | 3869.37 | 22.265 | 174.176 | 1830.64 | 75.32 | 0.11 | 4.75 | 14.072 | 9.953 | 0.9486 | 0.012 | -0.074 | 5.423 | 7.965 | 1.633 | 0.492 | 10.772 | 9.93 | 0.9486 | 4554.66 | 6753.94 | 32m 59.708s |
10-
| INT8 | False | True | 16 | 100 | 1 | 10000 | nan | nan | nan | nan | nan | nan | nan | nan | 5.952 | -296.164 | 39.802 | 1699.9 | 0.9486 | nan | nan | 22.235 | 2953.15 | nan | nan | nan | nan | 0.9486 | 4409.59 | 6753.95 | 1m 8.077s |
5+
| INT8 | False | True | 16 | 100 | 16 | 10000 | nan | nan | nan | nan | nan | nan | nan | nan | 1.908 | -110.203 | 68.833 | 283.133 | 0.9925 | nan | nan | 2.213 | -132.605 | nan | nan | nan | nan | 0.9925 | 4461.53 | 6753.95 | 1m 12.968s |
6+
| INT8 | False | True | 16 | 100 | 8 | 10000 | nan | nan | nan | nan | nan | nan | nan | nan | 2.134 | 332.609 | 43.301 | 1025.83 | 0.9893 | nan | nan | 2.39 | -1329.74 | nan | nan | nan | nan | 0.9893 | 4421.32 | 6753.95 | 47.838s |
7+
| INT8 | False | True | 16 | 100 | 4 | 10000 | nan | nan | nan | nan | nan | nan | nan | nan | 1.876 | 357.812 | 26.904 | 1008.11 | 0.9842 | nan | nan | 2.58 | -1359.07 | nan | nan | nan | nan | 0.9842 | 4392.71 | 6753.95 | 31.378s |
8+
| INT8 | False | True | 16 | 100 | 2 | 10000 | nan | nan | nan | nan | nan | nan | nan | nan | 1.906 | 243.973 | 16.362 | 382.398 | 0.9745 | nan | nan | 2.413 | -601.867 | nan | nan | nan | nan | 0.9745 | 4385.54 | 6753.95 | 20.699s |
9+
| INT8 | False | True | 16 | 100 | 1 | 10000 | 0 | 0 | 61.586 | 3947 | 14.242 | 191.828 | 1498.76 | 134.891 | 0.113 | 2.391 | 15.169 | 8.746 | 0.9492 | 0.008 | 0.078 | 5.293 | 5.301 | 1.699 | 0.348 | 10.255 | 13.27 | 0.9492 | 4642.39 | 6753.94 | 26m 47.691s |
10+
| INT8 | False | True | 16 | 100 | 1 | 10000 | nan | nan | nan | nan | nan | nan | nan | nan | 3.593 | -53.219 | 10.373 | 524.902 | 0.9492 | nan | nan | 4.34 | 3838.34 | nan | nan | nan | nan | 0.9492 | 4361.3 | 6753.95 | 18.691s |

bindings/python/src/arcadedb_embedded/core.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,9 @@ def create_vector_index(
243243
max_connections: int = 32,
244244
beam_width: int = 256,
245245
quantization: str = None,
246+
location_cache_size: Optional[int] = None,
247+
graph_build_cache_size: Optional[int] = None,
248+
mutations_before_rebuild: Optional[int] = None,
246249
store_vectors_in_graph: bool = False,
247250
add_hierarchy: Optional[bool] = None,
248251
pq_subspaces: Optional[int] = None,
@@ -278,6 +281,27 @@ def create_vector_index(
278281
Reduces memory usage and speeds up search at the cost of
279282
some precision. "PRODUCT" enables PQ data for
280283
approximate search (zero-disk-I/O path).
284+
location_cache_size: Per-index override for vector location cache size
285+
(maps to Java metadata key "locationCacheSize"; uses
286+
GlobalConfiguration default if None). Typical ranges by corpus size
287+
(vectors):
288+
- ~100K: 50k–100k
289+
- ~1M: 100k–200k
290+
- ~10M: 300k–500k
291+
- ~100M: 500k–800k (scale with heap)
292+
graph_build_cache_size: Per-index override for graph build cache size
293+
(maps to Java metadata key "graphBuildCacheSize"; uses
294+
GlobalConfiguration default if None). Typical ranges (higher = faster
295+
build, more RAM):
296+
- ~100K: 10k–30k
297+
- ~1M: 30k–75k
298+
- ~10M: 75k–150k
299+
- ~100M: 150k–250k (only if heap allows)
300+
mutations_before_rebuild: Per-index override for mutations threshold
301+
before triggering a graph rebuild (maps to Java metadata key
302+
"mutationsBeforeRebuild"; uses GlobalConfiguration default if None).
303+
Typical ranges: 100–300 for freshness-heavy workloads; 300–800 for
304+
write-heavy workloads and larger graphs.
281305
pq_subspaces: Number of PQ subspaces (M). Requires quantization="PRODUCT".
282306
pq_clusters: Clusters per subspace (K). Requires quantization="PRODUCT".
283307
pq_center_globally: Whether to globally center vectors before PQ.
@@ -349,6 +373,12 @@ def create_vector_index(
349373
metadata_cfg["storeVectorsInGraph"] = True
350374
if add_hierarchy is not None:
351375
metadata_cfg["addHierarchy"] = bool(add_hierarchy)
376+
if location_cache_size is not None:
377+
metadata_cfg["locationCacheSize"] = int(location_cache_size)
378+
if graph_build_cache_size is not None:
379+
metadata_cfg["graphBuildCacheSize"] = int(graph_build_cache_size)
380+
if mutations_before_rebuild is not None:
381+
metadata_cfg["mutationsBeforeRebuild"] = int(mutations_before_rebuild)
352382

353383
if metadata_cfg:
354384
# Use JSON configuration to avoid JPype overload ambiguity on put()

bindings/python/src/arcadedb_embedded/jvm.py

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -71,31 +71,18 @@ def start_jvm():
7171
JVM Memory Configuration (via environment variables):
7272
-----------------------------------------------------
7373
ARCADEDB_JVM_ARGS (optional)
74-
JVM arguments for memory and advanced configuration (space-separated).
75-
If not specified, defaults to: "-Xmx4g -Djava.awt.headless=true"
76-
77-
Common memory-related options:
78-
-Xmx<size>
79-
Maximum heap memory (e.g., "-Xmx8g")
80-
-Xms<size>
81-
Initial heap size (recommended: same as -Xmx)
82-
-XX:MaxDirectMemorySize=<size>
83-
Limit off-heap direct buffer memory
84-
-Darcadedb.vectorIndex.locationCacheSize=<count>
85-
Max vector locations to cache (controls LSM vector memory)
86-
-Darcadedb.vectorIndex.graphBuildCacheSize=<count>
87-
Max vectors cached during HNSW graph build
88-
-Darcadedb.vectorIndex.mutationsBeforeRebuild=<count>
89-
Mutations threshold before rebuilding HNSW graph
90-
-Djava.util.concurrent.ForkJoinPool.common.parallelism=<count>
91-
Limit threads for JVector graph construction (default: all cores)
74+
JVM arguments for memory and JVM-wide options (space-separated).
75+
If not specified, defaults to: "-Xmx4g -Djava.awt.headless=true".
76+
77+
Common options to set here (JVM-wide only):
78+
-Xmx<size> / -Xms<size> Heap sizing (must be set before JVM start)
79+
-XX:MaxDirectMemorySize=<size> Direct buffer cap
80+
-Djava.util.concurrent.ForkJoinPool.common.parallelism=<count> Limit
81+
common pool threads if you want fewer threads for graph builds
9282
9383
Examples:
94-
# Production with 8GB heap and bounded vector caches
95-
export ARCADEDB_JVM_ARGS="-Xmx8g -Xms8g -XX:MaxDirectMemorySize=8g \
96-
-Darcadedb.vectorIndex.locationCacheSize=100000 \
97-
-Darcadedb.vectorIndex.graphBuildCacheSize=3000 \
98-
-Darcadedb.vectorIndex.mutationsBeforeRebuild=200"
84+
# Production with 8GB heap
85+
export ARCADEDB_JVM_ARGS="-Xmx8g -Xms8g -XX:MaxDirectMemorySize=8g"
9986
10087
# Development/testing (smaller memory)
10188
export ARCADEDB_JVM_ARGS="-Xmx2g -Xms2g"

0 commit comments

Comments
 (0)