ITZMA is still taking shape, and its API can change between releases. Version 0.2.1: serde_with security fix
Docs / Guides

Vector search on object storage with ITZMA

Run vector search on Amazon S3, Google Cloud Storage or Azure Blob Storage with ITZMA. Learn how writes become durable and what drives query costs.

On this page

Why object storage?

Object storage is cheap per gigabyte, durable, and reachable from anywhere your code runs. ITZMA uses it as the only durable state: there is no database server holding data on its own disks. Your application embeds the library, and the library reads and writes plain objects in your bucket. Embedded vector database for Rust and Python explains the in-process side.

A namespace is a key prefix. Inside it:

text
<namespace>/
  schema.json                         dimension, metric, attribute types; written once
  manifest/current.json               live segments, fold point, indexes, format levels
  wal/00000000000000000001.json       one object per batch (binary despite the name)
  segments/<lo>-<hi>/data.bin         a segment, named by the WAL range it covers
  segments/<lo>-<hi>/index-<n>.bin    its dense index (HNSW or SQ8), generation n

The manifest is the one object that is ever overwritten. Everything else is written once and never changed. Storage layout lists every object and format.

Supported storage backends

ITZMA runs inside your Rust or Python application. For durable cloud storage, use Amazon S3, Google Cloud Storage or Azure Blob Storage. ITZMA also supports local filesystem and in-memory stores.

BackendPython store URLRust backend
Amazon S3s3://my-bucket/itzmaitzma-store-aws
Google Cloud Storagegs://my-bucket/itzmaitzma-store-gcs
Azure Blob Storageaz://my-container/itzmaitzma-store-azure
Local filesystemfile:///var/lib/itzmaobject_store::local::LocalFileSystem
In memorymemory://object_store::memory::InMemory

Rust applications use itzma-core with the backend they choose. Writes require put-if-absent. Compaction and indexing also require conditional manifest updates. The local filesystem backend supports creating namespaces, writing and querying, which suits development and single-machine tests, not production. A store counts as supported when it passes the conformance suite in the itzma-store crate; the S3, GCS and Azure adapters run it in CI against an emulator. See Object storage backends and requirements for configuration and backend capabilities.

Configure ITZMA with Amazon S3

In Python a store is a URL. Region and credentials come from the AWS SDK’s usual chain: AWS_* environment variables, ~/.aws profiles, web identity, then the container or instance role. This script creates a namespace on first run and opens it after that, writes 5,000 vectors in one batch, compacts and indexes them, and runs a filtered query:

python
import numpy as np

import itzma

# Region and credentials come from the AWS SDK's usual chain.
store = itzma.Store("s3://my-bucket/itzma", region="us-east-1")
schema = itzma.Schema(dim=8, metric=itzma.Metric.L2, attrs={"tenant": itzma.AttrType.STRING})

try:
    ns = itzma.Namespace.create(store, "products", schema, cache=itzma.Cache(ram_bytes=1 << 30))
except itzma.NamespaceExists:
    ns = itzma.Namespace.open(store, "products", cache=itzma.Cache(ram_bytes=1 << 30))

rng = np.random.default_rng(7)
ids = [f"p{i}" for i in range(5_000)]
seq = ns.upsert(
    ids=ids,
    vectors=rng.standard_normal((len(ids), 8)),
    attrs=[{"tenant": "acme" if i % 2 else "globex"} for i in range(len(ids))],
)
print("written through seq", seq)  # the batch is in the bucket now

# Fold the log into a segment, then index it.
print(ns.compact())
print(ns.index())

hits = ns.query(rng.standard_normal(8), top_k=3, filter=itzma.attr("tenant") == "acme")
print(hits.ids)
ns.close()

The credentials need to read, write and list under the prefix. Without s3:ListBucket, S3 answers a read of a missing object with 403 instead of 404. For MinIO or another S3-compatible service, pass endpoint=, and allow_http=True if it has no TLS. In Rust, the itzma-store-aws crate wraps the AWS SDK as an ObjectStore (S3Store::connect(bucket, S3Options)), and any other object_store backend works too.

How does a write become durable?

upsert and delete validate the whole batch before any storage call, so bad input writes nothing. Then the batch is written as one object, wal/<sequence number>, with put-if-absent. When the call returns, that object is in the bucket: there is no buffer in a server’s memory waiting to be flushed.

A batch is atomic: readers see all of it or none. Readers also see batches in order, never a later one without an earlier one. A batch is at most 64 MiB; a bigger load is split into several batches, each atomic on its own.

A write that fails after the request was sent may or may not have landed, and a plain retry can append it twice. For loads that must land once, give the write a key (key= in Python, upsert_keyed in Rust), and a retry finds the original instead of writing again. Writing covers keyed writes and large loads.

Which conditional operations does ITZMA need?

Two, and they are what lets many processes write with no coordinator, lock or leader:

  • Put-if-absent writes an object only if its key is free. Every write uses it to claim the next sequence number. If another writer took the number first, the call moves past it and tries again, up to 32 times.
  • Conditional update replaces an object only if it has not changed since it was read. Every manifest change uses it: compaction, indexing and format upgrades. A manifest update that loses a race is retried on the fresh contents, up to 32 times, so no update is lost.

Each cloud adapter maps these to the service’s own conditions: ETags on S3 and Azure, generations on GCS. A lost race is always reported as one, never as a silent overwrite.

What do cold and warm reads cost?

A query reads the manifest, the log entries not yet folded into segments, and the segments themselves. How much of a segment it reads depends on its index:

IndexWhat a query fetches from each segmentWhen
HNSWThe segment’s whole index object, in one request, then walks the graph in memoryThe index is warm in a cache
SQ8Only the partitions the query probesReads are uncached
No indexEvery live vector in the segment, bounded by the read budgetSegments under 4,096 rows, which index skips by default

A cold query pays an object-storage round trip for each of those reads. A warm one finds the bytes in the read cache: a RAM tier, and optionally an NVMe tier, keyed by object and byte range. Objects never change once written, so the cache never needs invalidating, only eviction. The manifest is never cached, so a query always sees the latest writes. A second cache, the decoded cache, keeps parsed structures so a warm query also skips decoding.

The fetch policy shapes the requests: byte ranges close together are merged into one request, and a long range is split into parts fetched in parallel. Every query may read at most a byte budget, 1 GiB by default, and fails with ReadBudgetExceeded past it. Caching and read budgets covers the settings, and Indexing compares HNSW and SQ8.

What drives request costs?

Object stores bill per request as well as per byte stored, so the number of requests matters as much as their size.

  • Writes. Each batch is one PUT, plus a retry for each sequence number another writer took first. A call is one batch, except that Python splits a big unkeyed write into several. Fewer, larger batches mean fewer requests.
  • The log. A query reads every log entry not yet folded into a segment, so a long log costs requests on every query. Scheduling maintain keeps it short: by default it compacts once the log reaches 64 objects or 64 MiB.
  • Queries. Each cold query reads the manifest plus the ranges its segments need. A cache in a long-lived process turns repeated reads into memory reads. Short-lived processes, such as serverless functions, start cold, and SQ8 reads less per cold query than HNSW.
  • Maintenance. Compaction reads the log and writes a segment, indexing reads segments and writes index objects, and each publishes with one conditional manifest update. gc deletes replaced segments once they are 24 hours old by default.

Your provider’s price list turns these counts into money.

Where to go next

  • Getting started: a first namespace in Rust or Python.
  • Maintenance: compaction, indexing and garbage collection, and how to schedule them.
  • Guarantees: exactly what a write and a query can rely on.
Docs
esc

Loading the docs…