| name | apollo-performance-tuning |
| description | Optimize Apollo.io API performance.
Use when improving API response times, reducing latency,
or optimizing bulk operations.
Trigger with phrases like "apollo performance", "optimize apollo",
"apollo slow", "apollo latency", "speed up apollo".
|
| allowed-tools | Read, Write, Edit, Bash(gh:*), Bash(curl:*) |
| version | 1.13.0 |
| license | MIT |
| author | Jeremy Longshore <jeremy@intentsolutions.io> |
| tags | ["saas","apollo","api","performance"] |
| compatibility | Designed for Claude Code, also compatible with Codex and OpenClaw |
Apollo Performance Tuning
Overview
Optimize Apollo.io API performance through response caching, connection pooling, bulk operations, parallel fetching, and result slimming. Key insight: search is free but slow (~500ms), enrichment costs credits — cache aggressively and batch enrichment calls.
Prerequisites
- Valid Apollo API key
- Node.js 18+
Instructions
Step 1: Connection Pooling
Reuse TCP connections to avoid TLS handshake overhead on every request.
import axios from 'axios';
import https from 'https';
const httpsAgent = new https.Agent({
keepAlive: true,
maxSockets: 10,
maxFreeSockets: 5,
timeout: 30_000,
});
export const optimizedClient = axios.create({
baseURL: 'https://api.apollo.io/api/v1',
headers: { 'Content-Type': 'application/json', 'x-api-key': process.env.APOLLO_API_KEY! },
httpsAgent,
timeout: 15_000,
});
Step 2: Response Caching with Per-Endpoint TTLs
import { LRUCache } from 'lru-cache';
const : <, > = {
: * * * ,
: * * * ,
: * * ,
: * * ,
: * * ,
};
cache = <, { : ; : }>({
: ,
: * * ,
: .(v).,
});
(): {
;
}
cachedRequest<T>(
: ,
: <T>,
: ,
): <T> {
key = (endpoint, params);
ttl = [endpoint] ?? * * ;
cached = cache.(key);
(cached && .() - cached. < ttl) cached.;
data = ();
cache.(key, { data, : .() });
data;
}
() {
{ : cache., : cache. };
}