import time, statisticstimes = []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 = 0for b in batches: index.upsert(vectors=b) total += len(b)elapsed = time.perf_counter() - tprint(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
Serverless
Variable latency; cold-start spikes
Cost ∝ usage
Best for variable load
Pod
Stable, low p99
Fixed cost
Best for steady load
6. Testing Concurrent Queries
Example: Concurrency
from concurrent.futures import ThreadPoolExecutordef run(qv): t = time.perf_counter() index.query(vector=qv, top_k=10) return (time.perf_counter() - t) * 1000with 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@profiledef 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.