Skip to main content

Performance Benchmark Results

This document outlines the performance benchmarks and SLO targets for Aragora's API endpoints.

SLO Targets​

Based on PERFORMANCE_TARGETS.md, the following latency targets apply:

Endpoint CategoryP50 TargetP95 TargetP99 Target
Health Check< 5ms< 20ms< 50ms
Authentication< 50ms< 150ms< 300ms
Simple API Call< 100ms< 300ms< 500ms
Search/Query< 200ms< 500ms< 1000ms

Running Benchmarks​

API Endpoint Benchmarks​

# Run with pytest
pytest benchmarks/api_endpoints.py -v

# Run as module
python -m benchmarks.api_endpoints

Memory Tier Benchmarks​

python -m benchmarks.memory_tiers

Debate Throughput Benchmarks​

python -m benchmarks.debate_throughput

Full Evaluation Suite​

python -m benchmarks.gauntlet_evaluation

Benchmark Methodology​

Latency Measurements​

  • Samples: 10,000 iterations per endpoint (default)
  • Warmup: 1,000 iterations discarded to allow JIT compilation
  • Metrics: P50, P95, P99, min, max, mean, stddev
  • Environment: Single-threaded, no network latency (mocked handlers)

Throughput Measurements​

  • Duration: 60-second sustained load
  • Concurrency: Variable (1, 10, 50, 100 concurrent requests)
  • Metrics: Requests/second, errors/second, success rate

Expected Results​

The following are target results on a modern development machine (M1/M2 Mac, 16GB RAM):

Health Check (/api/health)​

MetricTargetNotes
P500.01msIn-memory status check
P950.05msNo database access
P990.10msConstant time operation
OPS500,000+CPU-bound only

Authentication (/api/auth/validate)​

MetricTargetNotes
P501-5msJWT decode + cache check
P9510msCache miss scenario
P9925msDatabase lookup
OPS50,000+With token caching

Debate API (/api/debates/:id)​

MetricTargetNotes
P5010-20msDatabase fetch
P9550msCold cache
P99100msComplex debate with messages
OPS5,000+With connection pooling

Search (/api/debates/search)​

MetricTargetNotes
P5050-100msIndexed search
P95200msComplex query
P99400msLarge result set
OPS1,000+Depends on index size

Production Monitoring​

Metrics Collection​

All endpoints emit Prometheus-compatible metrics:

aragora_http_request_duration_seconds{endpoint="/api/health", method="GET"}
aragora_http_requests_total{endpoint="/api/debates", method="GET", status="200"}

Alerting Thresholds​

ConditionSeverityAction
P99 > 2x SLOWarningInvestigate
P99 > 5x SLOCriticalPage on-call
Error rate > 1%WarningInvestigate
Error rate > 5%CriticalPage on-call

Performance Tuning​

Database Connection Pool​

# Recommended settings
POOL_SIZE = 20
MAX_OVERFLOW = 10
POOL_TIMEOUT = 30
POOL_RECYCLE = 1800

Redis Cache​

# Recommended TTLs
AUTH_TOKEN_CACHE_TTL = 300 # 5 minutes
DEBATE_CACHE_TTL = 60 # 1 minute
SEARCH_CACHE_TTL = 30 # 30 seconds

Rate Limiting​

Default rate limits (per endpoint):

CategoryLimit
HealthUnlimited
Auth60/min
API (authenticated)120/min
Search30/min
Debates60/min

Continuous Benchmarking​

Benchmarks run automatically in CI on:

  • Pull requests (baseline comparison)
  • Main branch merges (regression detection)
  • Nightly builds (comprehensive suite)

Results are stored in .benchmarks/ and compared against baseline.

Hot Path Profiling Results​

Latest run: 2026-01-21

Core operations profiled with scripts/profile_hot_paths.py:

OperationAvg (ms)Min (ms)Max (ms)StdDev (ms)Iterations
Cosine similarity (1536d)0.2270.07362.4842.4631000
Text similarity (word-based)0.0020.0020.0700.0031000
SQLite SELECT (indexed)0.0170.0150.0850.003500
SQLite GROUP BY1.0060.26341.1234.380100
CritiqueStore.get_stats0.0110.0020.1990.027100
CritiqueStore.retrieve_patterns0.0140.0030.6870.071100
MetaCritiqueAnalyzer.analyze0.6100.2877.0940.979100

Recommendations:

  • SQLite GROUP BY aggregation (1.01ms avg) - consider caching for repeated queries
  • MetaCritiqueAnalyzer.analyze (0.61ms avg) - candidate for result caching