Database / ChromaDB Interview Questions
What are ChromaDB's practical size limits and performance characteristics at scale?
ChromaDB does not impose hard document count limits, but practical performance degrades at different thresholds depending on storage mode, hardware, and HNSW configuration. Understanding these helps you plan capacity and know when to consider alternatives.
| Collection size | Storage mode | Typical behaviour |
|---|---|---|
| < 100K docs | PersistentClient or HttpClient | Excellent — sub-10ms query latency |
| 100K – 1M docs | HttpClient (server mode) | Good — 10–100ms queries with default settings |
| 1M – 10M docs | HttpClient + HNSW tuning | Acceptable — tune hnsw:M and hnsw:search_ef |
| > 10M docs | Consider FAISS or Weaviate | ChromaDB may struggle — these are better at extreme scale |
import chromadb import time client = chromadb.Client() col = client.create_collection( "scale_test", metadata={ "hnsw:space": "cosine", "hnsw:construction_ef": 200, # higher quality index "hnsw:search_ef": 100, # higher recall at query time "hnsw:M": 32, # more connections per node }, ) # Batch insert 50,000 documents BATCH = 500 for i in range(0, 50_000, BATCH): col.add( documents=[f"Document about topic {j % 100}" for j in range(i, i+BATCH)], ids=[str(j) for j in range(i, i+BATCH)], ) print(f"Collection has {col.count()} documents") # Measure query latency start = time.perf_counter() results = col.query(query_texts=["topic 42"], n_results=10) elapsed = time.perf_counter() - start print(f"Query latency: {elapsed*1000:.1f}ms") # Memory footprint estimate: # 384-dim float32 vectors: 384 * 4 bytes = 1.5 KB per doc # 50K docs * 1.5 KB = ~75 MB just for vectors # HNSW graph adds ~20-30% overhead â ~100 MB total for 50K docs
Memory rule of thumb: each 384-dim vector requires ~1.5 KB. A 1M document collection with 384-dim embeddings needs ~1.5 GB just for vectors, plus HNSW graph overhead (~25%). Plan memory accordingly when deploying the ChromaDB server.
More Related questions...