Skip to content

Performance Profiler

Measures runtime performance — search latency, indexing throughput, memory, cache hit rate, error rate. Adapts operational parameters to your system tier.

Each metric is a RollingAverage — fixed window, oldest sample evicts when full.

MetricWindowMeasures
Search latency100 samplesTime to complete a vector/hybrid search
Indexing throughput50 samplesFiles/sec during indexing
Memory usage20 samplesHeap consumed by the extension
Cache hit rate100 samples% of queries served from cache
Error rate100 samples% of operations that fail

getMetrics() returns:

FieldMeaning
avgSearchLatencyMean of last 100 searches
p95SearchLatency95th percentile latency
avgIndexingThroughputMean files/sec
avgMemoryUsageMean heap (MB)
cacheHitRateMean cache hit percentage
errorRateMean error percentage
AlertSeverityTrigger
HIGH_SEARCH_LATENCYwarnP95 search latency > threshold
HIGH_MEMORY_USAGEwarnAverage memory > system limit
HIGH_ERROR_RATEcriticalError rate > acceptable threshold
LOW_THROUGHPUTinfoIndexing throughput < baseline

At startup, os.totalmem() + os.cpus().length place the system into a tier. Operational parameters auto-tuned per tier:

TierEmbedding batchCache sizeSearch timeoutIndexing concurrency
High (≥16 GB RAM, ≥8 cores)2010 00010 s8
Medium (8–16 GB, 4–8 cores)105 00015 s4
Low (<8 GB or <4 cores)52 00020 s2
const result = await profiler.measure("search", async () => vectorDb.search(query));

Records duration (ms), memory delta (heap before → after), and success/failure. Failures increment the error-rate metric.

  • Telemetry — OTel spans + OTLP export
  • Caching — the caches whose hit rate this measures