Benchmarking Performance
1. Setting Up Benchmark Environment
| Setting | Detail |
|---|---|
| Same region as client | Eliminate network latency variance |
| Warm index | Run 100 warmup queries |
| Production-like data | Realistic dim + filter cardinality |
2. Measuring Query Latency
Example: Latency Bench
import time, statistics
times = []
for qv in queries:
t = time.perf_counter()
index.query(vector=qv, top_k=10)
times.append((time.perf_counter() - t) * 1000)
print("p50", statistics.median(times))
print("p95", statistics.quantiles(times, n=20)[18])
print("p99", statistics.quantiles(times, n=100)[98])
3. Measuring Upsert Throughput
Example: Throughput
t = time.perf_counter()
total = 0
for b in batches:
index.upsert(vectors=b)
total += len(b)
elapsed = time.perf_counter() - t
print(f"{total/elapsed:.0f} vectors/sec")
4. Benchmarking Different Pod Types
| Pod | Typical QPS | Typical p95 |
|---|---|---|
| s1.x1 | ~50 | 50-80ms |
| p1.x1 | ~100 | 20-40ms |
| p2.x1 | ~200 | 10-20ms |
Note: Numbers are illustrative; benchmark with your own data.
5. Comparing Serverless vs Pod-Based
6. Testing Concurrent Queries
Example: Concurrency
from concurrent.futures import ThreadPoolExecutor
def run(qv):
t = time.perf_counter()
index.query(vector=qv, top_k=10)
return (time.perf_counter() - t) * 1000
with ThreadPoolExecutor(max_workers=50) as ex:
times = list(ex.map(run, queries))
7. Measuring Connection Overhead
| Op | Typical Cost |
|---|---|
| SDK init | ~50-200ms (cache & reuse) |
| Index handle | 1 round-trip |
| Per-query | RTT + server time |
8. Profiling Memory Usage
Example: Memory Profiler
from memory_profiler import profile
@profile
def upsert_all():
for b in batches: index.upsert(vectors=b)
9. Benchmarking Different Metrics
| Metric | Relative Speed |
|---|---|
| dotproduct | Fastest (no normalization) |
| cosine | Fast (normalized) |
| euclidean | Comparable |
10. Documenting Benchmark Results
| Field | Detail |
|---|---|
| Index spec | type, pods, replicas, dim, metric |
| Dataset | vector count, namespace count, metadata size |
| Client | SDK version, region, concurrency |
| Results | p50/p95/p99, QPS, error rate |
11. Comparing with Other Vector DBs
Note: Use a published benchmark (e.g. ann-benchmarks) for apples-to-apples. Pinecone is managed, so factor ops cost too.
| DB | Strength |
|---|---|
| Pinecone | Managed, scaling, ecosystem |
| Weaviate | Hybrid, modules |
| Qdrant | Self-host, payload filters |
| pgvector | SQL-native, small scale |
12. Optimizing Based on Benchmarks
| Finding | Action |
|---|---|
| High p99, low avg | Add replicas; tune client pool |
| Low QPS ceiling | Upgrade pod / add replicas |
| Slow filters | Reduce cardinality; selective indexing |
| Cold-start spikes | Keep-warm pings or move to pod |