By Abhijith N M · Reviewed 24 October 2026 · Editorial standards
A normal endpoint returns in 50 ms. An AI endpoint streams tokens for eight seconds and charges by the word. That changes what you measure and how many users you can support before the provider rate-limits you.
concurrent requests = arrival rate x average latency
20 requests/second x 4 seconds each = 80 requests in flight
If your provider allows 30 concurrent requests, you do not have a 20 RPS system.
You have a 7.5 RPS system with a queue that grows forever.This single calculation catches more launch-day surprises than any dashboard. Do it before you write a single test script.
| Metric | Why | Good target (support bot) |
|---|---|---|
| Time to first token (p50/p95) | What users actually feel | p95 < 1.2 s |
| Total latency (p50/p95/p99) | Timeout budgets and retries | p95 < 4 s |
| Error rate by status | 429s appear only under load | < 0.5%, and zero 5xx |
| Tokens per request | Cost scales with load | Stable across concurrency |
// k6 run load.js -e BASE_URL=... -e API_KEY=...
import http from 'k6/http';
import { check } from 'k6';
export const options = {
scenarios: {
steady: { executor: 'constant-vus', vus: 20, duration: '3m' },
ramp: { executor: 'ramping-vus', startVUs: 1,
stages: [{ target: 40, duration: '2m' }, { target: 40, duration: '2m' }] },
},
thresholds: {
http_req_duration: ['p(95)<4000'],
http_req_failed: ['rate<0.005'],
},
};
export default function () {
const res = http.post(`${__ENV.BASE_URL}/ask`,
JSON.stringify({ question: 'Can I return a sale item?' }),
{ headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${__ENV.API_KEY}` } });
check(res, { 'status is 200': (r) => r.status === 200 });
}Key takeaways
Use Little's Law to size concurrency before you test.
Measure time to first token and total latency separately.
Load-test your endpoint, not the provider's raw quota.
Force the provider-down path and assert a graceful, fast failure.
Written and edited by the nexGenCoders team. Spotted a mistake? Tell us and we will fix it.
Don't lose this lesson
Create a free account to save your progress, keep your streak, and work toward a shareable certificate.