Performance Optimization
Maximize throughput and minimize latency. Our API is designed for speed with sub-100ms responses for 95% of requests globally.
Response Time Benchmarks
| Endpoint | p50 | p95 | p99 |
|---|---|---|---|
| Simple Valuation | 45ms | 120ms | 250ms |
| Detailed Valuation | 85ms | 200ms | 450ms |
| Batch (10 items) | 180ms | 350ms | 600ms |
| Batch (100 items) | 450ms | 800ms | 1200ms |
| Product Search | 25ms | 80ms | 150ms |
| Webhook Delivery | 50ms | 150ms | 300ms |
* Benchmarks measured from US-East region. Results may vary by location.
Quick Wins
70-90% Smaller
Enable gzip/brotli compression for dramatically smaller payloads
10x Throughput
Batch up to 100 items per request instead of individual calls
50ms Saved
Connection pooling eliminates TLS handshake on every request
Optimization Techniques
Enable Compression
Accept gzip/br compressed responses to reduce payload size by 70-90%.
// Request with compression
fetch('https://api.justkalm.com/v1/valuations', {
headers: {
'Accept-Encoding': 'gzip, br',
'Authorization': 'Bearer YOUR_API_KEY'
}
});
// Response headers
// Content-Encoding: gzip
// X-Original-Size: 12450
// X-Compressed-Size: 1832Use Field Selection
Request only the fields you need with the fields parameter.
// Request specific fields only
GET /v1/valuations/val_123?fields=id,estimated_value,confidence
// Instead of receiving 15+ fields, get only 3
{
"data": {
"id": "val_123",
"estimated_value": { "min": 1200000, "max": 1450000 },
"confidence": "high"
}
}Connection Pooling
Reuse HTTP connections to eliminate TLS handshake overhead.
// Node.js with keep-alive
const https = require('https');
const agent = new https.Agent({
keepAlive: true,
maxSockets: 50,
keepAliveMsecs: 30000
});
// Python with requests Session
import requests
session = requests.Session()
adapter = requests.adapters.HTTPAdapter(
pool_connections=10,
pool_maxsize=50,
max_retries=3
)
session.mount('https://', adapter)Batch Requests
Combine multiple valuations into a single batch request.
// Instead of 10 separate requests
// Make 1 batch request
POST /v1/valuations/batch
{
"items": [
{ "sku": "SKU-001", "brand": "Hermès" },
{ "sku": "SKU-002", "brand": "Chanel" },
// ... up to 100 items
]
}
// ~10x faster than individual requestsCache Responses
Cache valuation results for repeat lookups. Use ETag/If-None-Match.
// First request - store ETag
const response = await fetch('/v1/valuations/val_123');
const etag = response.headers.get('ETag');
localStorage.setItem('val_123_etag', etag);
// Subsequent request - conditional
const cached = await fetch('/v1/valuations/val_123', {
headers: { 'If-None-Match': etag }
});
if (cached.status === 304) {
// Use cached data
}Regional Endpoints
Use region-specific endpoints for lower latency.
// Default (auto-routed) https://api.justkalm.com/v1/ // Region-specific endpoints https://us.api.justkalm.com/v1/ // US East https://eu.api.justkalm.com/v1/ // EU Frankfurt https://ap.api.justkalm.com/v1/ // APAC Tokyo
Monitor Your Performance
Every response includes timing headers you can use to monitor performance:
HTTP/1.1 200 OK X-Response-Time: 45ms X-Request-Id: req_abc123 X-RateLimit-Remaining: 995 CF-Cache-Status: DYNAMIC CF-Ray: 8a1b2c3d4e5f-IAD // Use X-Response-Time to track latency // Use X-Request-Id for debugging slow requests
Run Your Own Benchmarks
Test performance from your location with our benchmarking suite.