diff --git a/AGENTS.md b/AGENTS.md
index e2f8bb662..873ea923c 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -2,10 +2,10 @@
## Project Overview
-Rust implementation of a vector database benchmarking tool. **15 engines**:
+Rust implementation of a vector database benchmarking tool. **16 engines**:
Redis (RediSearch), VectorSets, Valkey, Dragonfly, KiviDB, Elasticsearch,
OpenSearch, Qdrant, pgvector, Weaviate, Milvus, MongoDB, Chroma, Turbopuffer,
-Vertex AI.
+Vertex AI, Azure Cosmos DB for NoSQL.
The thing this repo optimises for is **not being wrong**. Its dominant historical
bug class is a run that completes, reports a plausible number, and measured
@@ -62,6 +62,7 @@ make integration-test-{valkey,dragonfly,kividb,chroma}
make integration-test-{pgvector,qdrant,elasticsearch,opensearch}
make integration-test-{weaviate,milvus,mongodb}
make integration-test-vertex # cloud-only, needs real GCP credentials
+make integration-test-cosmosdb # cloud-only, needs a Cosmos DB account key
make integration-test-no-docker
```
@@ -107,7 +108,7 @@ src/
bin/
vector_db_benchmark/
main.rs cli.rs config.rs dataset.rs download.rs experiment.rs ground_truth.rs
- engine/ # 15 engines + shared: mod.rs redis_utils.rs filter_guard.rs
+ engine/ # 16 engines + shared: mod.rs redis_utils.rs filter_guard.rs
# index_naming.rs geo.rs
generate_dataset.rs # -> `generate-dataset`, writes the synthetic-* fixtures
prepare_msmarco.rs # -> `prepare-msmarco`, builds/verifies MS MARCO corpora
@@ -454,6 +455,7 @@ now covers more engines than `v0/` did; the table below is the mapping.
| Dragonfly | — | `dragonfly` | `redis` 0.27 (RESP) |
| KiviDB | — | `kividb` | `redis` 0.27 (RESP) |
| Chroma | — | `chroma` | `reqwest` (REST v2) |
+| Azure Cosmos DB for NoSQL | — | `cosmosdb` | `azure_data_cosmos` 1.0 |
| Vertex AI | — | `vertex` | `tonic`/`prost` (gRPC) + `reqwest` — cloud-only |
\* Valkey GLIDE has no Rust crate ([valkey-io/valkey-glide#828](https://github.com/valkey-io/valkey-glide/issues/828), closed NOT_PLANNED). GLIDE maintainers recommend `redis-rs` for Rust.
diff --git a/Cargo.lock b/Cargo.lock
index 7aa4006ce..60dedcbed 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2,6 +2,15 @@
# It is not intended for manual editing.
version = 4
+[[package]]
+name = "addr2line"
+version = "0.27.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e567177890eb1617b1f774005b66b26b2377afd138a2ca37aae7d8f0c81429d4"
+dependencies = [
+ "gimli",
+]
+
[[package]]
name = "adler2"
version = "2.0.1"
@@ -104,6 +113,15 @@ dependencies = [
"derive_arbitrary",
]
+[[package]]
+name = "arc-swap"
+version = "1.9.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "84a22b5d51209f6de83d37a0b33d320acb8da88823e42a94c075140708f032a5"
+dependencies = [
+ "rustversion",
+]
+
[[package]]
name = "arcstr"
version = "1.2.0"
@@ -128,6 +146,17 @@ dependencies = [
"tokio",
]
+[[package]]
+name = "async-lock"
+version = "3.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0876700b0d007ad25d5508865a4259c3af9af6d296bf663a0d586d0bc3369f6f"
+dependencies = [
+ "event-listener",
+ "event-listener-strategy",
+ "pin-project-lite",
+]
+
[[package]]
name = "async-stream"
version = "0.3.6"
@@ -220,6 +249,119 @@ dependencies = [
"tower-service",
]
+[[package]]
+name = "azure_core"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4e41cbd819986ba41904c207d8ffc4106f8f8352a548d773e9554906379bb2fb"
+dependencies = [
+ "async-lock",
+ "async-trait",
+ "azure_core_macros",
+ "bytes",
+ "futures",
+ "hmac 0.12.1",
+ "pin-project",
+ "rustc_version",
+ "serde",
+ "serde_json",
+ "sha2 0.10.9",
+ "tokio",
+ "tracing",
+ "typespec",
+ "typespec_client_core",
+]
+
+[[package]]
+name = "azure_core_macros"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b9b52dba6a345f3ad2d42ff8d0d63df9d0994cfa29657bf18ffdbf149f78a4f5"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.118",
+ "tracing",
+]
+
+[[package]]
+name = "azure_data_cosmos"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "aa75d1999be85b351fb1ace2f48d8df5f13c428fb3c437e0c97214ef2c9a7e9b"
+dependencies = [
+ "async-lock",
+ "async-trait",
+ "azure_core",
+ "azure_data_cosmos_driver",
+ "base64",
+ "futures",
+ "pin-project",
+ "reqwest 0.13.4",
+ "serde",
+ "serde_json",
+ "time",
+ "tracing",
+ "url",
+]
+
+[[package]]
+name = "azure_data_cosmos_driver"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "926a4817a6a75095120f444d71ed59c79edc6178845d7955f4170146ae91d433"
+dependencies = [
+ "arc-swap",
+ "async-lock",
+ "async-trait",
+ "azure_core",
+ "azure_data_cosmos_macros",
+ "backtrace",
+ "base64",
+ "bytes",
+ "crossbeam-epoch",
+ "futures",
+ "getrandom 0.4.3",
+ "h2",
+ "rand 0.10.2",
+ "reqwest 0.13.4",
+ "rustc_version",
+ "serde",
+ "serde_json",
+ "time",
+ "tokio",
+ "tracing",
+ "url",
+ "uuid",
+ "windows",
+]
+
+[[package]]
+name = "azure_data_cosmos_macros"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0bedd703baf5f2026093d87de0f79dbd43b1f1e067cb005f1cc643a618295882"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.118",
+]
+
+[[package]]
+name = "backtrace"
+version = "0.3.77"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "42f4220217f3288537b83684130f42fad43320b1c3b805f1910d683d52ded24f"
+dependencies = [
+ "addr2line",
+ "cfg-if",
+ "libc",
+ "miniz_oxide 0.9.1",
+ "object",
+ "rustc-demangle",
+ "windows-link",
+]
+
[[package]]
name = "base64"
version = "0.22.1"
@@ -250,6 +392,15 @@ dependencies = [
"wyz",
]
+[[package]]
+name = "block-buffer"
+version = "0.10.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71"
+dependencies = [
+ "generic-array",
+]
+
[[package]]
name = "block-buffer"
version = "0.12.1"
@@ -357,7 +508,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d524456ba66e72eb8b115ff89e01e497f8e6d11d78b70b1aa13c0fbd97540a81"
dependencies = [
"cfg-if",
- "cpufeatures",
+ "cpufeatures 0.3.0",
"rand_core 0.10.1",
]
@@ -536,6 +687,15 @@ version = "0.8.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b"
+[[package]]
+name = "cpufeatures"
+version = "0.2.17"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280"
+dependencies = [
+ "libc",
+]
+
[[package]]
name = "cpufeatures"
version = "0.3.0"
@@ -606,6 +766,16 @@ version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5"
+[[package]]
+name = "crypto-common"
+version = "0.1.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a"
+dependencies = [
+ "generic-array",
+ "typenum",
+]
+
[[package]]
name = "crypto-common"
version = "0.2.2"
@@ -795,15 +965,26 @@ dependencies = [
"unicode-xid",
]
+[[package]]
+name = "digest"
+version = "0.10.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
+dependencies = [
+ "block-buffer 0.10.4",
+ "crypto-common 0.1.7",
+ "subtle",
+]
+
[[package]]
name = "digest"
version = "0.11.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1dd6dbb5841937940781866fa1281a1ff7bd3bf827091440879f9994983d5c2"
dependencies = [
- "block-buffer",
+ "block-buffer 0.12.1",
"const-oid",
- "crypto-common",
+ "crypto-common 0.2.2",
"ctutils",
]
@@ -882,6 +1063,26 @@ dependencies = [
"windows-sys 0.61.2",
]
+[[package]]
+name = "event-listener"
+version = "5.4.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5a23add41df1562121a9393cb065eab5146a1242410f23a644851e90cfd669d2"
+dependencies = [
+ "parking",
+ "pin-project-lite",
+]
+
+[[package]]
+name = "event-listener-strategy"
+version = "0.5.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8be9f3dfaaffdae2972880079a491a1a8bb7cbed0b8dd7a347f668b4150a3b93"
+dependencies = [
+ "event-listener",
+ "pin-project-lite",
+]
+
[[package]]
name = "fallible-iterator"
version = "0.2.0"
@@ -917,7 +1118,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "843fba2746e448b37e26a819579957415c8cef339bf08564fe8b7ddbd959573c"
dependencies = [
"crc32fast",
- "miniz_oxide",
+ "miniz_oxide 0.8.9",
]
[[package]]
@@ -1044,6 +1245,16 @@ dependencies = [
"slab",
]
+[[package]]
+name = "generic-array"
+version = "0.14.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a"
+dependencies = [
+ "typenum",
+ "version_check",
+]
+
[[package]]
name = "getrandom"
version = "0.2.17"
@@ -1085,6 +1296,12 @@ dependencies = [
"wasm-bindgen",
]
+[[package]]
+name = "gimli"
+version = "0.34.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1033caf0b349c518623b5396bfb2cf0bddf44f0306d543a250e5743297aafd10"
+
[[package]]
name = "glob"
version = "0.3.3"
@@ -1093,9 +1310,9 @@ checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280"
[[package]]
name = "h2"
-version = "0.4.15"
+version = "0.4.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6cb093c84e8bd9b188d4c4a8cb6579fc016968d14c99882163cd3ff402a4f155"
+checksum = "7d29020232d6aa3fb1daca64c1127cf662cf97f254ae16c18c05b8ab635fc118"
dependencies = [
"atomic-waker",
"bytes",
@@ -1297,13 +1514,22 @@ dependencies = [
"tracing",
]
+[[package]]
+name = "hmac"
+version = "0.12.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e"
+dependencies = [
+ "digest 0.10.7",
+]
+
[[package]]
name = "hmac"
version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6303bc9732ae41b04cb554b844a762b4115a61bfaa81e3e83050991eeb56863f"
dependencies = [
- "digest",
+ "digest 0.11.3",
]
[[package]]
@@ -1879,7 +2105,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "69b6441f590336821bb897fb28fc622898ccceb1d6cea3fde5ea86b090c4de98"
dependencies = [
"cfg-if",
- "digest",
+ "digest 0.11.3",
]
[[package]]
@@ -1904,6 +2130,15 @@ dependencies = [
"simd-adler32",
]
+[[package]]
+name = "miniz_oxide"
+version = "0.9.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b63fbc4a50860e98e7b2aa7804ded1db5cbc3aff9193adaff57a6931bf7c4b4c"
+dependencies = [
+ "adler2",
+]
+
[[package]]
name = "mio"
version = "1.2.1"
@@ -1968,7 +2203,7 @@ dependencies = [
"hickory-net",
"hickory-proto",
"hickory-resolver",
- "hmac",
+ "hmac 0.13.0",
"macro_magic",
"md-5",
"mongocrypt",
@@ -1982,7 +2217,7 @@ dependencies = [
"serde_bytes",
"serde_with",
"sha1",
- "sha2",
+ "sha2 0.11.0",
"socket2 0.6.4",
"stringprep",
"strsim",
@@ -2153,6 +2388,15 @@ dependencies = [
"objc2-core-foundation",
]
+[[package]]
+name = "object"
+version = "0.40.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dd229a0361b9d0d4396176e02d65897f487eebeab7caa6d443855ee152ca0b9c"
+dependencies = [
+ "memchr",
+]
+
[[package]]
name = "once_cell"
version = "1.21.4"
@@ -2242,6 +2486,12 @@ dependencies = [
"vcpkg",
]
+[[package]]
+name = "parking"
+version = "2.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba"
+
[[package]]
name = "parking_lot"
version = "0.11.2"
@@ -2302,7 +2552,7 @@ version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "112d82ceb8c5bf524d9af484d4e4970c9fd5a0cc15ba14ad93dccd28873b0629"
dependencies = [
- "digest",
+ "digest 0.11.3",
]
[[package]]
@@ -2453,11 +2703,11 @@ dependencies = [
"byteorder",
"bytes",
"fallible-iterator",
- "hmac",
+ "hmac 0.13.0",
"md-5",
"memchr",
"rand 0.10.2",
- "sha2",
+ "sha2 0.11.0",
"stringprep",
]
@@ -2907,7 +3157,7 @@ dependencies = [
"url",
"wasm-bindgen",
"wasm-bindgen-futures",
- "wasm-streams",
+ "wasm-streams 0.4.2",
"web-sys",
"webpki-roots",
]
@@ -2921,10 +3171,13 @@ dependencies = [
"base64",
"bytes",
"futures-core",
+ "futures-util",
+ "h2",
"http",
"http-body",
"http-body-util",
"hyper",
+ "hyper-rustls",
"hyper-tls",
"hyper-util",
"js-sys",
@@ -2939,12 +3192,14 @@ dependencies = [
"sync_wrapper",
"tokio",
"tokio-native-tls",
+ "tokio-util",
"tower 0.5.3",
"tower-http",
"tower-service",
"url",
"wasm-bindgen",
"wasm-bindgen-futures",
+ "wasm-streams 0.5.0",
"web-sys",
]
@@ -2968,6 +3223,12 @@ dependencies = [
"windows-sys 0.52.0",
]
+[[package]]
+name = "rustc-demangle"
+version = "0.1.28"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b74b56ffa8bb2830709a538c2cbcae9aa062db0d2a42563bfb09bdaae44020eb"
+
[[package]]
name = "rustc-hash"
version = "2.1.3"
@@ -3257,8 +3518,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aacc4cc499359472b4abe1bf11d0b12e688af9a805fa5e3016f9a386dc2d0214"
dependencies = [
"cfg-if",
- "cpufeatures",
- "digest",
+ "cpufeatures 0.3.0",
+ "digest 0.11.3",
]
[[package]]
@@ -3267,6 +3528,17 @@ version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbfa15b3dddfee50a0fff136974b3e1bde555604ba463834a7eb7deb6417705d"
+[[package]]
+name = "sha2"
+version = "0.10.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283"
+dependencies = [
+ "cfg-if",
+ "cpufeatures 0.2.17",
+ "digest 0.10.7",
+]
+
[[package]]
name = "sha2"
version = "0.11.0"
@@ -3274,8 +3546,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "446ba717509524cb3f22f17ecc096f10f4822d76ab5c0b9822c5f9c284e825f4"
dependencies = [
"cfg-if",
- "cpufeatures",
- "digest",
+ "cpufeatures 0.3.0",
+ "digest 0.11.3",
]
[[package]]
@@ -3871,6 +4143,57 @@ version = "1.20.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20"
+[[package]]
+name = "typespec"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "753a2fe021e407d4fc9ee6f4f0a33403cc306d5c54c4e4ebe1b8cbde0ca052b9"
+dependencies = [
+ "base64",
+ "bytes",
+ "futures",
+ "serde",
+ "serde_json",
+ "url",
+]
+
+[[package]]
+name = "typespec_client_core"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0373af0f9d4f580b3a1a9d9639cedaabe015ed262b35bfbe13941bfb14fe1ea6"
+dependencies = [
+ "async-trait",
+ "base64",
+ "bytes",
+ "dyn-clone",
+ "futures",
+ "pin-project",
+ "rand 0.10.2",
+ "reqwest 0.13.4",
+ "serde",
+ "serde_json",
+ "time",
+ "tokio",
+ "tracing",
+ "typespec",
+ "typespec_macros",
+ "url",
+ "uuid",
+]
+
+[[package]]
+name = "typespec_macros"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2c608f4427943f8adb211abc95c87672b1b98847152783507d54e3246e502f60"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "rustc_version",
+ "syn 2.0.118",
+]
+
[[package]]
name = "ucd-trie"
version = "0.1.7"
@@ -3966,6 +4289,7 @@ checksum = "bf80a72845275afea99e7f2b434723d3bc7e38470fcd1c7ed39a599c73319a53"
dependencies = [
"getrandom 0.4.3",
"js-sys",
+ "rand 0.10.2",
"serde_core",
"wasm-bindgen",
]
@@ -3980,6 +4304,7 @@ checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
name = "vector_db_benchmark"
version = "0.2.0"
dependencies = [
+ "azure_data_cosmos",
"base64",
"bzip2",
"chrono",
@@ -3987,6 +4312,7 @@ dependencies = [
"crc32fast",
"elasticsearch",
"flate2",
+ "futures",
"glob",
"half",
"hdf5",
@@ -4010,7 +4336,7 @@ dependencies = [
"reqwest 0.12.28",
"serde",
"serde_json",
- "sha2",
+ "sha2 0.11.0",
"tar",
"tempfile",
"tokio",
@@ -4151,6 +4477,19 @@ dependencies = [
"web-sys",
]
+[[package]]
+name = "wasm-streams"
+version = "0.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9d1ec4f6517c9e11ae630e200b2b65d193279042e28edd4a2cda233e46670bbb"
+dependencies = [
+ "futures-util",
+ "js-sys",
+ "wasm-bindgen",
+ "wasm-bindgen-futures",
+ "web-sys",
+]
+
[[package]]
name = "web-sys"
version = "0.3.103"
@@ -4230,6 +4569,27 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
+[[package]]
+name = "windows"
+version = "0.62.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "527fadee13e0c05939a6a05d5bd6eec6cd2e3dbd648b9f8e447c6518133d8580"
+dependencies = [
+ "windows-collections",
+ "windows-core",
+ "windows-future",
+ "windows-numerics",
+]
+
+[[package]]
+name = "windows-collections"
+version = "0.3.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "23b2d95af1a8a14a3c7367e1ed4fc9c20e0a26e79551b1454d72583c97cc6610"
+dependencies = [
+ "windows-core",
+]
+
[[package]]
name = "windows-core"
version = "0.62.2"
@@ -4243,6 +4603,17 @@ dependencies = [
"windows-strings",
]
+[[package]]
+name = "windows-future"
+version = "0.3.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e1d6f90251fe18a279739e78025bd6ddc52a7e22f921070ccdc67dde84c605cb"
+dependencies = [
+ "windows-core",
+ "windows-link",
+ "windows-threading",
+]
+
[[package]]
name = "windows-implement"
version = "0.60.2"
@@ -4271,6 +4642,16 @@ version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
+[[package]]
+name = "windows-numerics"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6e2e40844ac143cdb44aead537bbf727de9b044e107a0f1220392177d15b0f26"
+dependencies = [
+ "windows-core",
+ "windows-link",
+]
+
[[package]]
name = "windows-registry"
version = "0.6.1"
@@ -4334,6 +4715,15 @@ dependencies = [
"windows_x86_64_msvc",
]
+[[package]]
+name = "windows-threading"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3949bd5b99cafdf1c7ca86b43ca564028dfe27d66958f2470940f73d86d75b37"
+dependencies = [
+ "windows-link",
+]
+
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.52.6"
diff --git a/Cargo.toml b/Cargo.toml
index 8d352bdaf..d9466e9e2 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -53,6 +53,8 @@ sha2 = "0.11"
crc32fast = "1.5"
hdrhistogram = "7.5"
base64 = "0.22"
+azure_data_cosmos = { version = "1.0", default-features = false, features = ["control_plane", "hmac_rust", "key_auth", "native_tls"] }
+futures = "0.3"
# Only for `--features release-static` (the prebuilt release archives, #366):
# compile HDF5, zlib and OpenSSL from source and link them statically, so the
diff --git a/Makefile b/Makefile
index 09aac5705..9736033b6 100644
--- a/Makefile
+++ b/Makefile
@@ -323,6 +323,11 @@ integration-test-vertex:
@echo "=== Vertex AI integration tests (cloud-only, needs GCP credentials) ==="
cargo test --test integration_vertex --release -- --test-threads=1
+.PHONY: integration-test-cosmosdb
+integration-test-cosmosdb:
+ @echo "=== Azure Cosmos DB for NoSQL integration tests (cloud-only) ==="
+ cargo test --test integration_cosmosdb --release -- --nocapture --test-threads=1
+
.PHONY: integration-test-no-docker
integration-test-no-docker:
@echo "=== Running integration tests (assumes redis on port 6399) ==="
@@ -572,6 +577,7 @@ help:
@echo " make integration-test-kividb - KiviDB 1.1.2"
@echo " make integration-test-chroma - Chroma"
@echo " make integration-test-vertex - Vertex AI (cloud-only, needs GCP creds)"
+ @echo " make integration-test-cosmosdb - Azure Cosmos DB for NoSQL (cloud-only)"
@echo ""
@echo " Docker:"
@echo " make docker-build - Build Docker image (IMAGE_TAG=latest)"
diff --git a/README.md b/README.md
index 0a5ce5f03..9cb5e8bb1 100644
--- a/README.md
+++ b/README.md
@@ -167,6 +167,7 @@ host's Redis on Linux, and on Docker Desktop only with host networking enabled):
| **Vertex AI** (Vector Search) | `reqwest` (Vertex AI REST v1) | HTTP/REST (cloud) | L2, Cosine, Dot | Yes [\*\*\*\*](#vertex-note) |
| **Chroma** | `reqwest` (Chroma v2 REST API) | HTTP/REST | L2, Cosine, IP | Yes [\*\*\*\*\*](#chroma-note) |
| **KiviDB** | `redis` 1.8.1 | RESP protocol | L2, Cosine, IP | Yes [\*\*\*\*\*\*](#kividb-note) |
+| **Azure Cosmos DB for NoSQL** | `azure_data_cosmos` 1.0 | Azure SDK (cloud) | L2, Cosine, Dot | No |
\* **Valkey client note:** Valkey GLIDE has no published Rust crate ([valkey-io/valkey-glide#828](https://github.com/valkey-io/valkey-glide/issues/828), closed NOT_PLANNED). The GLIDE maintainers recommend using `redis-rs` for Rust and upstream their improvements to it. The `redis` crate works with Valkey since it speaks the same RESP protocol.
@@ -183,6 +184,132 @@ host's Redis on Linux, and on Docker Desktop only with host networking enabled):
\*\*\*\*\* **Chroma note:** Uses **Chroma** (OSS) via its **v2 REST API** — a collection of records (`ids` + `embeddings` + scalar `metadatas`) queried with `query` + a `where` document. **Metadata filters** map directly onto the canonical model: `match` → `$eq`, `match_any` → `$in`, `range` → `$gte`/`$gt`/`$lte`/`$lt`, and **AND / OR / nested boolean** to Chroma's native `$and` / `$or` (which nest arbitrarily). Supported datatypes: **keyword, int, float, bool, uuid, datetime** (stored as epoch-seconds int, like Milvus, so numeric range operators apply). **Full-text** (`{match:{text}}`) is supported via `where_document` `$contains` — the `text`-typed field's value is uploaded as each record's Chroma `document`. **NOT supported** by Chroma's metadata engine: **geo-radius** and multi-valued **`labels` arrays** (Chroma metadata values are scalar only). Geo is a *permanent* gap, not a to-do: Chroma's `where` is a closed enum of `field OP literal` comparisons with no geospatial operator, no attribute-vs-attribute comparison and no arithmetic, and a spherical cap is not an axis-aligned box in any query-independent coordinate system — so there is no exact encoding, and an inexact bounding box would under-constrain the query while looking filtered (#223). Since #219 these are a hard **error**, not a silent drop — and a condition tree containing a geo leaf is refused *whole*, so a `geo AND keyword` query cannot quietly run as keyword-only. See the note below. Runs over HTTP/REST via Docker; set the host port with `CHROMA_PORT` (default `8000`, test compose maps `8003`), and optionally `CHROMA_COLLECTION` / `CHROMA_TENANT` / `CHROMA_DATABASE`. Distance space (`l2`/`cosine`/`ip`) is set per collection from the dataset metric.
+### Azure Cosmos DB for NoSQL
+
+Enable **Vector Search for NoSQL API** on your Cosmos DB account. Set
+`AZURE_COSMOS_ENDPOINT` to the account URL and provide the account key through
+the `AZURE_COSMOS_KEY` environment variable.
+
+```bash
+export AZURE_COSMOS_DATABASE=vdb-benchmark
+export AZURE_COSMOS_RU_PER_SECOND=400
+vector-db-benchmark --engines cosmosdb-flat --datasets random-100 --skip-if-exists false
+make integration-test-cosmosdb
+```
+
+For an Azure-hosted benchmark over Private Link, place the client VM in the
+Cosmos DB region. Create a NoSQL private endpoint with subresource `Sql` and
+link the `privatelink.documents.azure.com` private DNS zone to the VM's virtual
+network. Keep `AZURE_COSMOS_ENDPOINT` set to the standard account URL
+(`https://.documents.azure.com:443/`). From the VM, run
+`nslookup .documents.azure.com` and confirm the address matches the
+private endpoint before running the benchmark. See Microsoft's
+[Cosmos DB Private Link setup guide](https://learn.microsoft.com/en-us/azure/cosmos-db/how-to-configure-private-endpoints).
+
+The benchmark creates the database if needed and provisions a dedicated
+container per config and dataset. It uses manual throughput of 400 RU/s by
+default. Set `AZURE_COSMOS_RU_PER_SECOND=serverless` for a serverless account,
+or set a higher manual throughput for a larger provisioned run. For a
+throughput sweep, give each engine config its own name and a
+`"collection_params": { "ru_per_second": 1000 }` override. Search and upload
+parallelism are independently configurable. The 400 RU/s default is suitable
+for smoke tests. When the SDK exhausts its HTTP 429 retry budget on an upload
+write, the runner backs off and sends the write again, up to 60 times per
+row, and reports how many writes it resent. Upload time includes that
+backoff, so raise the RU/s or reduce `upload_params.parallel` for a
+meaningful upload figure. Set
+`AZURE_COSMOS_REGION` to prefer an Azure region by name. The runner removes
+its container after a successful run unless you pass `--keep-data`. The
+database remains available for subsequent runs. Use `--skip-upload` to reuse
+an existing container with a complete corpus. If the upload fails, the
+runner removes the container it created. A run that fails later, for example
+on the index-use probe or during search, leaves a complete corpus in a
+provisioned container that continues billing until you remove it.
+
+Each Cosmos search result carries `results.cosmosdb_search_diagnostics` with
+the SDK's request charge, request attempt count, and observed HTTP 429 count
+for measured query pages. Warm-ups and verification queries are outside this
+scope. SDK backoff and retries are part of the measured search latency.
+Check `attempts_without_status` and `queries_without_request_diagnostics`
+when interpreting the 429 count.
+
+By default, the adapter uses the SDK's full-container query, which drains
+the partitions sequentially for `ORDER BY VectorDistance`. Set
+`"search_params": { "partition_concurrency": "auto" }` on a search entry to
+query disjoint physical feed ranges concurrently and merge their scored
+top-K candidates into one global top K. The adapter looks up the feed ranges
+before timing. `"auto"` uses their count as the per-query concurrency, and
+a positive integer caps it at that value. Across all workers, the maximum
+number of in-flight range queries is the greater of the worker count and the
+effective per-query concurrency. When the worker count exceeds the range
+count, range queries wait for a free slot inside the measured latency, so
+compare a fan-out row with a stock row on throughput and recall, not on tail
+latency.
+
+Before timing, the adapter runs up to eight sampled queries under both modes,
+with the stock query sent twice. Repeated DiskANN requests can return
+different neighbors at the cutoff, so the stock query's disagreement with
+itself sets the bar. Fan-out may miss at most three times as many stock IDs
+as the repeated stock request misses. Flat is exact, so it needs identical
+IDs. A larger difference or a feed-range change fails the run. Fan-out
+results record both counts under `partition_fanout.parity`, with the
+effective limits, RU charge, and HTTP attempts for all ranges.
+
+For DiskANN, each search entry can set positive integer
+`search_params.search_list_size_multiplier` and
+`search_params.quantized_vector_list_multiplier`. These map to the
+`VectorDistance` query options `searchListSizeMultiplier` and
+`quantizedVectorListMultiplier`. Leave both unset for the service defaults.
+Add multiple search entries under one engine config to sweep query-time
+settings on the same index, keeping `top` fixed for recall comparisons.
+The shipped `cosmosdb-diskann` config compares the service defaults with
+search-list multipliers of 1, 5, 10, and 20 at parallelism 1 and 8, all at
+top-10. The quantized-vector-list multiplier uses the service default.
+
+To sweep DiskANN index builds, use `--engines 'cosmosdb-diskann-build-*'`
+with a dataset of at least 64 dimensions. Each named config provisions its
+own container and uses the same top-10 searches at parallelism 1 and 8 with
+service-default query settings. The presets vary
+`collection_params.indexing_search_list_size` at 50, 100, and 200 with
+quantization fixed at 32 bytes, and vary `collection_params.quantization_byte_size`
+at 16, 32, and 64 with the indexing search list fixed at 100. The benchmark
+checks the realized values before search, including on container reuse.
+With the Rust SDK, the build search list accepts integers from 25 to 500
+and the quantization size accepts integers from 1 to the smaller of 512
+and the vector dimension. Omit a build setting to use the Azure default.
+See the [Rust SDK vector index model](https://github.com/Azure/azure-sdk-for-rust/blob/d7e28a1cd76e11d51f005e5d502a6c1c6299f74a/sdk/cosmos/azure_data_cosmos/src/models/indexing_policy.rs#L274-L290).
+
+The opt-in DBpedia example uses 10,000 RU/s per container. It runs four
+index builds and measures top-100 searches at parallelism 1 and 100. The
+command uses the registered 975K DBpedia dataset with 100 reference neighbors.
+Run it from a repository checkout.
+
+```bash
+vector-db-benchmark \
+ --engines-file experiments/examples/cosmosdb-dbpedia-index-sweep.json \
+ --datasets dbpedia-openai-975K-1536-angular-100neighbors
+```
+
+The adapter benchmarks dense, unfiltered top-K queries across the whole
+container. It verifies the vector policy and corpus cardinality. The
+`cosmosdb-flat` configuration supports up to 505 dimensions. The
+`cosmosdb-diskann` configuration supports up to 4,096 dimensions and requires
+at least 1,000 vectors. Cosmos DB can scan while an index builds or while a
+physical partition has too few vectors. Before any DiskANN search, the adapter
+therefore probes each feed range. It runs one forced scan and then repeats an
+index-requested query, at first every 2 seconds and then less often up to
+every 30 seconds, until that query costs less than half
+the scan's request charge on every range. The run fails if a range does not
+get there within 30 minutes. Set `AZURE_COSMOS_INDEX_PROBE_SECONDS` to change
+the limit, or to `0` to skip the probe. Results record the per-range charges
+and `vector_index_use_verified`, which is `false` when the probe was skipped.
+The SDK reads further `AZURE_COSMOS_*` settings from the environment, such
+as retry and connection options. Every such variable that is set is recorded
+in the result's effective configuration, with the account key redacted.
+After an upload, `upload_time` covers the upserts and `total_time` adds the
+probe's wait for the index. The row-count check is in neither. See
+[Azure Cosmos DB vector indexing](https://learn.microsoft.com/azure/cosmos-db/nosql/vector-search).
+
### Filters an engine cannot express are a hard error (#219)
@@ -1298,12 +1425,11 @@ vector-db-benchmark compare-results dumps/opensearch-hrrf dumps/redis-hrrf --ref
`--skip-upload` asserts *"the server already holds the corpus I want"*. Three
rules follow, and all three are enforced:
-1. **The configure phase never runs.** `configure()` is destructive on **14 of the
- 15 engines** — `FT.DROPINDEX … DD` (Redis), `FT.DROPINDEX` + `SCAN`/`UNLINK`
+1. **The configure phase never runs.** `configure()` is destructive on 14 of the 16 engines — `FT.DROPINDEX … DD` (Redis), `FT.DROPINDEX` + `SCAN`/`UNLINK`
(Valkey / Dragonfly / KiviDB), `collection.drop()` (MongoDB), `DROP TABLE`
(pgvector), `DELETE /collections/` (Qdrant / Chroma / Weaviate / Milvus /
Turbopuffer), `indices.delete` (Elasticsearch / OpenSearch), `DEL `
- (VectorSets). Only Vertex is non-destructive. Until #238 the
+ (VectorSets). Vertex and Cosmos DB preserve existing data during configuration. Until #238 the
`--skip-upload --skip-vector-index` combination still called it: the flags that
mean *"do not upload, do not build an index, just use what is there"* deleted
the corpus and then benchmarked the empty index — printing a QPS number and
diff --git a/experiments/configurations/cosmosdb.json b/experiments/configurations/cosmosdb.json
new file mode 100644
index 000000000..a9d06b1c8
--- /dev/null
+++ b/experiments/configurations/cosmosdb.json
@@ -0,0 +1,85 @@
+[
+ {
+ "name": "cosmosdb-flat",
+ "engine": "cosmosdb",
+ "algorithm": "flat",
+ "upload_params": { "parallel": 8 },
+ "search_params": [
+ { "top": 10, "parallel": 1 },
+ { "top": 10, "parallel": 8 }
+ ]
+ },
+ {
+ "name": "cosmosdb-diskann",
+ "engine": "cosmosdb",
+ "algorithm": "diskANN",
+ "upload_params": { "parallel": 8 },
+ "search_params": [
+ { "top": 10, "parallel": 1 },
+ { "top": 10, "parallel": 8 },
+ { "top": 10, "parallel": 1, "search_params": { "search_list_size_multiplier": 1 } },
+ { "top": 10, "parallel": 1, "search_params": { "search_list_size_multiplier": 5 } },
+ { "top": 10, "parallel": 1, "search_params": { "search_list_size_multiplier": 10 } },
+ { "top": 10, "parallel": 1, "search_params": { "search_list_size_multiplier": 20 } },
+ { "top": 10, "parallel": 8, "search_params": { "search_list_size_multiplier": 1 } },
+ { "top": 10, "parallel": 8, "search_params": { "search_list_size_multiplier": 5 } },
+ { "top": 10, "parallel": 8, "search_params": { "search_list_size_multiplier": 10 } },
+ { "top": 10, "parallel": 8, "search_params": { "search_list_size_multiplier": 20 } }
+ ]
+ },
+ {
+ "name": "cosmosdb-diskann-build-list50-bytes32",
+ "engine": "cosmosdb",
+ "algorithm": "diskANN",
+ "collection_params": { "indexing_search_list_size": 50, "quantization_byte_size": 32 },
+ "upload_params": { "parallel": 8 },
+ "search_params": [
+ { "top": 10, "parallel": 1 },
+ { "top": 10, "parallel": 8 }
+ ]
+ },
+ {
+ "name": "cosmosdb-diskann-build-list100-bytes32",
+ "engine": "cosmosdb",
+ "algorithm": "diskANN",
+ "collection_params": { "indexing_search_list_size": 100, "quantization_byte_size": 32 },
+ "upload_params": { "parallel": 8 },
+ "search_params": [
+ { "top": 10, "parallel": 1 },
+ { "top": 10, "parallel": 8 }
+ ]
+ },
+ {
+ "name": "cosmosdb-diskann-build-list200-bytes32",
+ "engine": "cosmosdb",
+ "algorithm": "diskANN",
+ "collection_params": { "indexing_search_list_size": 200, "quantization_byte_size": 32 },
+ "upload_params": { "parallel": 8 },
+ "search_params": [
+ { "top": 10, "parallel": 1 },
+ { "top": 10, "parallel": 8 }
+ ]
+ },
+ {
+ "name": "cosmosdb-diskann-build-list100-bytes16",
+ "engine": "cosmosdb",
+ "algorithm": "diskANN",
+ "collection_params": { "indexing_search_list_size": 100, "quantization_byte_size": 16 },
+ "upload_params": { "parallel": 8 },
+ "search_params": [
+ { "top": 10, "parallel": 1 },
+ { "top": 10, "parallel": 8 }
+ ]
+ },
+ {
+ "name": "cosmosdb-diskann-build-list100-bytes64",
+ "engine": "cosmosdb",
+ "algorithm": "diskANN",
+ "collection_params": { "indexing_search_list_size": 100, "quantization_byte_size": 64 },
+ "upload_params": { "parallel": 8 },
+ "search_params": [
+ { "top": 10, "parallel": 1 },
+ { "top": 10, "parallel": 8 }
+ ]
+ }
+]
diff --git a/experiments/examples/cosmosdb-dbpedia-index-sweep.json b/experiments/examples/cosmosdb-dbpedia-index-sweep.json
new file mode 100644
index 000000000..937016dd4
--- /dev/null
+++ b/experiments/examples/cosmosdb-dbpedia-index-sweep.json
@@ -0,0 +1,206 @@
+[
+ {
+ "name": "cosmosdb-diskann-10000ru-buildlist-50-qbytes-256",
+ "engine": "cosmosdb",
+ "algorithm": "diskANN",
+ "collection_params": {
+ "ru_per_second": 10000,
+ "indexing_search_list_size": 50,
+ "quantization_byte_size": 256
+ },
+ "upload_params": {
+ "parallel": 16
+ },
+ "search_params": [
+ {
+ "top": 100,
+ "parallel": 1
+ },
+ {
+ "top": 100,
+ "parallel": 100
+ },
+ {
+ "top": 100,
+ "parallel": 100,
+ "search_params": {
+ "search_list_size_multiplier": 1
+ }
+ },
+ {
+ "top": 100,
+ "parallel": 100,
+ "search_params": {
+ "search_list_size_multiplier": 5
+ }
+ },
+ {
+ "top": 100,
+ "parallel": 100,
+ "search_params": {
+ "search_list_size_multiplier": 10
+ }
+ },
+ {
+ "top": 100,
+ "parallel": 100,
+ "search_params": {
+ "search_list_size_multiplier": 20
+ }
+ }
+ ]
+ },
+ {
+ "name": "cosmosdb-diskann-10000ru-buildlist-200-qbytes-256",
+ "engine": "cosmosdb",
+ "algorithm": "diskANN",
+ "collection_params": {
+ "ru_per_second": 10000,
+ "indexing_search_list_size": 200,
+ "quantization_byte_size": 256
+ },
+ "upload_params": {
+ "parallel": 16
+ },
+ "search_params": [
+ {
+ "top": 100,
+ "parallel": 1
+ },
+ {
+ "top": 100,
+ "parallel": 100
+ },
+ {
+ "top": 100,
+ "parallel": 100,
+ "search_params": {
+ "search_list_size_multiplier": 1
+ }
+ },
+ {
+ "top": 100,
+ "parallel": 100,
+ "search_params": {
+ "search_list_size_multiplier": 5
+ }
+ },
+ {
+ "top": 100,
+ "parallel": 100,
+ "search_params": {
+ "search_list_size_multiplier": 10
+ }
+ },
+ {
+ "top": 100,
+ "parallel": 100,
+ "search_params": {
+ "search_list_size_multiplier": 20
+ }
+ }
+ ]
+ },
+ {
+ "name": "cosmosdb-diskann-10000ru-buildlist-100-qbytes-128",
+ "engine": "cosmosdb",
+ "algorithm": "diskANN",
+ "collection_params": {
+ "ru_per_second": 10000,
+ "indexing_search_list_size": 100,
+ "quantization_byte_size": 128
+ },
+ "upload_params": {
+ "parallel": 16
+ },
+ "search_params": [
+ {
+ "top": 100,
+ "parallel": 1
+ },
+ {
+ "top": 100,
+ "parallel": 100
+ },
+ {
+ "top": 100,
+ "parallel": 100,
+ "search_params": {
+ "search_list_size_multiplier": 1
+ }
+ },
+ {
+ "top": 100,
+ "parallel": 100,
+ "search_params": {
+ "search_list_size_multiplier": 5
+ }
+ },
+ {
+ "top": 100,
+ "parallel": 100,
+ "search_params": {
+ "search_list_size_multiplier": 10
+ }
+ },
+ {
+ "top": 100,
+ "parallel": 100,
+ "search_params": {
+ "search_list_size_multiplier": 20
+ }
+ }
+ ]
+ },
+ {
+ "name": "cosmosdb-diskann-10000ru-buildlist-100-qbytes-512",
+ "engine": "cosmosdb",
+ "algorithm": "diskANN",
+ "collection_params": {
+ "ru_per_second": 10000,
+ "indexing_search_list_size": 100,
+ "quantization_byte_size": 512
+ },
+ "upload_params": {
+ "parallel": 16
+ },
+ "search_params": [
+ {
+ "top": 100,
+ "parallel": 1
+ },
+ {
+ "top": 100,
+ "parallel": 100
+ },
+ {
+ "top": 100,
+ "parallel": 100,
+ "search_params": {
+ "search_list_size_multiplier": 1
+ }
+ },
+ {
+ "top": 100,
+ "parallel": 100,
+ "search_params": {
+ "search_list_size_multiplier": 5
+ }
+ },
+ {
+ "top": 100,
+ "parallel": 100,
+ "search_params": {
+ "search_list_size_multiplier": 10
+ }
+ },
+ {
+ "top": 100,
+ "parallel": 100,
+ "search_params": {
+ "search_list_size_multiplier": 20
+ }
+ }
+ ]
+ }
+]
diff --git a/src/bin/vector_db_benchmark/config.rs b/src/bin/vector_db_benchmark/config.rs
index efe434620..dfefa8cf8 100644
--- a/src/bin/vector_db_benchmark/config.rs
+++ b/src/bin/vector_db_benchmark/config.rs
@@ -2136,6 +2136,7 @@ mod shipped_config_knob_guard {
("kividb", &["kividb.rs"]),
("vertex", &["vertex.rs", "vertex_grpc.rs"]),
("chroma", &["chroma.rs"]),
+ ("cosmosdb", &["cosmosdb.rs"]),
];
/// Top-level `search_params[]` knobs consumed by the runner
diff --git a/src/bin/vector_db_benchmark/effective_config.rs b/src/bin/vector_db_benchmark/effective_config.rs
index 2d260c06e..b73b1a8ba 100644
--- a/src/bin/vector_db_benchmark/effective_config.rs
+++ b/src/bin/vector_db_benchmark/effective_config.rs
@@ -108,6 +108,7 @@ const SECRET_MARKERS: &[&str] = &[
// and this one did not.
"PWD",
"API_KEY",
+ "AZURE_COSMOS_KEY",
"APIKEY",
"ACCESS_KEY",
"PRIVATE_KEY",
@@ -187,6 +188,12 @@ const DECLARED_KEY_ALLOWLIST: &[&str] = &[
"type",
"number_of_shards",
"is_tenant",
+ // Cosmos DB DiskANN
+ "indexing_search_list_size",
+ "quantization_byte_size",
+ "search_list_size_multiplier",
+ "quantized_vector_list_multiplier",
+ "partition_concurrency",
// SVS-VAMANA
"svs-vamana_config",
"GRAPH_MAX_DEGREE",
@@ -208,6 +215,7 @@ const DECLARED_KEY_ALLOWLIST: &[&str] = &[
"default_segment_number",
// upload
"parallel",
+ "ru_per_second",
"batch_size",
"timeout",
// a single-letter key that a shipped config genuinely uses
@@ -1039,6 +1047,23 @@ pub fn env_opt(name: &str) -> Option {
value
}
+/// Record every set environment variable whose name starts with `prefix`.
+///
+/// For a client library that reads its own settings from the environment
+/// (transport, retry and pool options the adapter never names). They change
+/// what a run measures, so they belong in the artifact like any other knob.
+/// Secrets are redacted by name as usual.
+pub fn observe_env_prefix(prefix: &str) {
+ let mut names: Vec = std::env::vars_os()
+ .filter_map(|(name, _)| name.into_string().ok())
+ .filter(|name| name.starts_with(prefix))
+ .collect();
+ names.sort();
+ for name in names {
+ let _ = env_opt(&name);
+ }
+}
+
/// Record a resolved knob that did not come straight from one environment
/// variable — a value chosen between the environment, the configuration file
/// and a built-in default, or read back off the server.
@@ -2200,6 +2225,22 @@ mod tests {
}
}
+ #[test]
+ fn a_prefix_scan_records_settings_the_adapter_never_names() {
+ let _l = test_lock();
+ let _a = EnvGuard::set("VDBB_PREFIX_TEST_POOL_SIZE", Some("32"));
+ let _b = EnvGuard::set("VDBB_PREFIX_TEST_API_KEY", Some("prefix-secret"));
+ let _c = EnvGuard::set("VDBB_OTHER_TEST_SETTING", Some("ignored"));
+ reset();
+ observe_env_prefix("VDBB_PREFIX_TEST_");
+ let s = snapshot();
+ assert_eq!(s["env"]["VDBB_PREFIX_TEST_POOL_SIZE"], "32");
+ assert_eq!(s["effective"]["VDBB_PREFIX_TEST_POOL_SIZE"], "32");
+ assert_eq!(s["env"]["VDBB_PREFIX_TEST_API_KEY"], REDACTED);
+ assert!(!serde_json::to_string(&s).unwrap().contains("prefix-secret"));
+ assert!(s["env"].get("VDBB_OTHER_TEST_SETTING").is_none());
+ }
+
#[test]
fn env_parsed_records_the_number_the_caller_received() {
let _l = test_lock();
@@ -2372,12 +2413,19 @@ mod tests {
("REDIS_AUTH", "s3cret"),
("VERTEX_ACCESS_TOKEN", "ya29.xyz"),
("MONGODB_PASSWORD", "pw"),
+ ("AZURE_COSMOS_KEY", "synthetic-cosmos-key"),
] {
r.observe_env(name, Some(raw));
}
let s = r.snapshot();
let serialized = serde_json::to_string(&s).unwrap();
- for leak in ["hunter2", "sk-abc", "s3cret", "ya29.xyz"] {
+ for leak in [
+ "hunter2",
+ "sk-abc",
+ "s3cret",
+ "ya29.xyz",
+ "synthetic-cosmos-key",
+ ] {
assert!(
!serialized.contains(leak),
"{leak} leaked into the artifact"
@@ -2385,6 +2433,7 @@ mod tests {
}
// …but the fact that authentication was configured survives.
assert_eq!(s["env"]["ELASTIC_PASSWORD"], REDACTED);
+ assert_eq!(s["env"]["AZURE_COSMOS_KEY"], REDACTED);
}
#[test]
diff --git a/src/bin/vector_db_benchmark/engine/cosmosdb.rs b/src/bin/vector_db_benchmark/engine/cosmosdb.rs
new file mode 100644
index 000000000..558d99ab9
--- /dev/null
+++ b/src/bin/vector_db_benchmark/engine/cosmosdb.rs
@@ -0,0 +1,840 @@
+//! Azure Cosmos DB for NoSQL adapter using the official Rust SDK.
+
+use std::num::NonZeroU32;
+use std::sync::atomic::{AtomicUsize, Ordering};
+use std::time::{Duration, Instant};
+
+use azure_data_cosmos::feed::FeedRange;
+use azure_data_cosmos::models::{
+ ContainerProperties, ThroughputProperties, VectorDistanceFunction, VectorIndexType,
+};
+use azure_data_cosmos::options::{
+ ContentResponseOnWrite, CreateContainerOptions, MaxItemCountHint, OperationOptionsBuilder,
+ QueryOptions, ReadFeedRangesOptions,
+};
+use azure_data_cosmos::{
+ AccountReference, ContainerClient, CosmosClient, CosmosRuntime, FeedScope, Query,
+ RoutingStrategy,
+};
+use futures::{stream, StreamExt, TryStreamExt};
+use serde::Serialize;
+use tokio::sync::Semaphore;
+use vector_db_benchmark::cosmosdb::{
+ await_index_use, container_name, container_policy, count_stable_ranges, fan_out_hits,
+ index_probe_deadline, index_type, knn_query, manual_throughput, parity_sample_indices,
+ positive_u32, reject_unknown_keys, retry_throttled, sample_parity, scan_query, upload_parallel,
+ validate_corpus_size, validate_hit_count, validate_query_vector, validate_top,
+ vector_distance_function, verify_policy, DiskAnnBuildOptions, IndexProbe, KnnQueryText,
+ ParityTally, PartitionConcurrency, PartitionFanout, ProbeQuery, QueryHit, SearchDiagnostics,
+};
+use vector_db_benchmark::start_gate::WorkerPool;
+use vector_db_benchmark::workload::IndexLayout;
+
+use super::{compute_search_stats, CorpusCount, Engine, SearchResults, UploadStats};
+use crate::config::{EngineConfig, SearchParams};
+use crate::dataset::Dataset;
+
+#[derive(Clone, Copy, Serialize)]
+struct Item<'a> {
+ id: &'a str,
+ embedding: &'a [f32],
+}
+
+const SEARCH_LIST_SIZE: &str = "search_list_size_multiplier";
+const QUANTIZED_VECTOR_LIST: &str = "quantized_vector_list_multiplier";
+const PARTITION_CONCURRENCY: &str = "partition_concurrency";
+const SEARCH_KNOBS: [&str; 3] = [
+ SEARCH_LIST_SIZE,
+ QUANTIZED_VECTOR_LIST,
+ PARTITION_CONCURRENCY,
+];
+const COLLECTION_KEYS: [&str; 3] = [
+ "ru_per_second",
+ "indexing_search_list_size",
+ "quantization_byte_size",
+];
+const UNSUPPORTED_SEARCH_KNOB: &str =
+ "Cosmos DB supports only DiskANN search multipliers and partition_concurrency as tuning knobs";
+const UNSUPPORTED_COLLECTION_KEY: &str =
+ "Cosmos DB collection_params supports only ru_per_second, indexing_search_list_size and quantization_byte_size";
+/// Sampled queries compared across routing modes before a fan-out search.
+const PARITY_SAMPLES: usize = 8;
+/// Feed ranges whose IDs are counted at once.
+const ROW_COUNT_CONCURRENCY: usize = 16;
+/// TOP K of the index-use probe queries.
+const INDEX_PROBE_TOP: usize = 10;
+/// Feed ranges probed at once.
+const INDEX_PROBE_CONCURRENCY: usize = 16;
+/// Sampled parity queries in flight at once.
+const PARITY_CONCURRENCY: usize = 4;
+
+fn positive_knob(params: &SearchParams, key: &str) -> Result