What LLM Gateway Load Testing Actually Measures

LLM gateway load testing measures how an AI routing layer behaves under realistic and deliberately increased traffic. A gateway may sit between applications and one or more model providers, handling authentication, quotas, retries, timeouts, caching, model selection, observability, and request transformation. The goal is not simply to generate the largest possible requests-per-second number. It is to determine which bottlenecks appear first, how failures propagate, and whether users receive predictable service as concurrency rises.

Also worth reading: Which LLM Gateway Performance Metrics Matter Most for Production Workloads? · How Do You Evaluate a Production AI Router Without Flaky Benchmarks? · How should organizations approach scaling B2B support with AI agents without breaking internal workflows?

A useful test distinguishes three workloads: short requests with low token generation, long-context requests, and streaming responses. Each creates different pressure. Input processing can stress context handling, output generation can hold connections open for many seconds, and streaming tests can expose proxy buffering or timeout defects. By September 2026, teams should also test mixed traffic because production gateways rarely carry one model, prompt length, or latency target. A benchmark based only on short, non-streaming prompts can look healthy while the real application fails under long documents or concurrent tool-augmented agents.

The primary measures should be end-to-end latency, time to first token, tokens per second, error rate, queue time, provider throttling rate, and cost per successful request. Record results at the 50th, 95th, and 99th percentiles rather than relying on an average. For example, a gateway with a 1,800-millisecond average may still be unsuitable if its 99th-percentile time to first token reaches 20 seconds. Load testing should also compare capacity before and after retries, because automatic retries can multiply upstream traffic precisely when a provider begins returning 429 responses.

Designing a Representative LLM Traffic Test

Start by constructing a workload matrix from sanitized production telemetry, not from a generic traffic generator. The matrix should include the top prompt-length bands, streaming and non-streaming requests, supported models, and representative success or error responses. As a practical starting point, test 10%, 25%, 50%, 75%, and 100% of observed peak concurrency, then continue in controlled increments until a defined limit is reached. These percentages are not universal capacity limits; they are a disciplined way to locate a degradation point relative to the application’s current peak.

A production system that peaks at 20 requests per second should not jump directly to 200. Increase offered load in stages while holding token distribution and payload composition steady. Include short prompts of roughly 100–300 input tokens, medium requests of 500–2,000 tokens, and long-context cases above 2,000 tokens if the application permits them. For output, test fixed or bounded generation lengths, such as 128, 512, and 1,024 tokens, because unrestricted maximum generation settings can make one test run unnecessarily expensive and distort concurrency.

The environment must also reflect production behavior. Use realistic system prompts, schemas, tool payloads, and attachment sizes, but remove customer data. If the gateway uses semantic caching, include a measured proportion of repeated requests; if it does not, the benchmark should not credit the system with cache hits it cannot achieve. Run each sustained stage for at least 15–30 minutes, and keep a warm-up period before recording measurements. Short five-minute bursts often miss memory growth, connection-pool exhaustion, token-bucket depletion, and delayed rate-limit violations.

A Practical Load-Test Procedure

The first phase is a baseline. Record normal traffic for at least one representative business cycle, including busy and quiet periods if possible. Capture requests per second, concurrent users, input and output token distributions, time to first token, total completion time, provider selection, and error categories. Then create synthetic requests that reproduce this distribution while excluding real personal or business information. A baseline is essential because otherwise a team may mistake a pre-existing provider slowdown for a gateway defect.

The second phase is a controlled capacity test. Raise concurrency by 10% increments, or by fixed stages such as 20, 40, 80, and 120 concurrent requests, and retain each stage long enough for steady state. A stage should end when latency or errors breach a predefined objective, not merely when the test tool stops. Suggested service objectives include a 95th-percentile first-token latency below 2 seconds for interactive traffic, a 99th-percentile error rate below 1%, and no sustained provider 429 rate above 2%. These are starting thresholds, not industry rules; an asynchronous summarization service may accept much slower first-token latency than a voice agent.

The third phase is stress testing. Continue past the expected capacity boundary to find queue growth, retry storms, memory pressure, and timeout behavior. Set hard test budgets, such as 5,000 synthetic requests, 10 million generated tokens, or a maximum wall-clock duration of two hours, whichever comes first. The fourth phase is soak testing: hold a moderate load below the discovered failure point for several hours. An eight-hour soak can reveal leaked connections or steadily increasing queues, while a shorter 60-minute run may be enough for a stateless proxy in a limited proof of concept.

Metrics, Failure Signals, and Acceptance Criteria

Latency must be separated into gateway overhead, provider queue time, time to first token, and token-generation duration. A total latency figure alone cannot tell whether the gateway added 40 milliseconds or whether a provider spent 15 seconds processing a long prompt. Instrument queue depth, active connections, retry counts, cache hit rate, rate-limit rejections, DNS latency, and upstream connection reuse. For streaming workloads, verify the interval between tokens as well as the first-token delay, because a response can begin quickly and then stall when buffers fill or an upstream connection is reused incorrectly.

Define pass, warning, and failure conditions before the test. For example, pass might mean no more than 1% non-business errors, less than 2% throttling, 95th-percentile first-token latency under 2 seconds, and gateway overhead under 100 milliseconds at peak load. A warning might be a 2–5% error rate or a p95 above 3 seconds, requiring investigation but not immediate termination. Failure should include uncontrolled queue growth, memory growth above an agreed percentage, repeated 502 or 504 responses, or retry volume that exceeds 10% of requests. These numbers should be adjusted to the application’s actual service level objectives.

Cost must be treated as both a test budget and a capacity signal. Divide total inference spend by successful requests to calculate cost per completion, and track spend per 1,000 tokens by provider and model. A system that returns many 429 errors may appear inexpensive because it rejects work early, but it is not operationally successful. Likewise, fallback routing can preserve availability while raising cost sharply if a premium fallback handles requests that would otherwise have waited. Report the availability-versus-cost trade-off rather than presenting one route configuration as universally superior.

Comparing Load-Testing Approaches and Gateway Alternatives

There is no requirement to purchase a dedicated enterprise gateway before testing. A small application can use a lightweight proxy and a controlled test client, while a multi-team platform may need centralized policies, persistent metrics, and provider failover. Managed AI gateways can reduce operational work but add vendor cost and routing dependencies. Open-source gateways such as LiteLLM can provide flexibility and may be economical when the team already operates containers, but deployment, upgrades, observability, and support become the customer’s responsibility.

FeatureLiteLLM-style open-source proxyManaged AI gatewayDirect provider access
Test setupRequires hosting and configurationUsually includes a managed control planeMinimal gateway configuration
Routing controlHigh when the team can modify and operate itHigh through supported policiesLimited to provider-native options
Capacity isolationStrong in a dedicated test environmentDepends on the plan and service limitsEntirely within the provider account
Operational burdenHigherLower, but plan-dependentLowest
Cost modelInfrastructure plus engineering laborSubscription, usage, or plan-based feesToken and request pricing from provider
Best fitTechnical teams needing controlMulti-team production platformsSimple, low-volume applications
The comparison is not between product brands alone. Kong, AWS API Gateway, Apigee, Cloudflare AI Gateway, LiteLLM, and newer orchestration systems can occupy different layers. A general API gateway may authenticate and rate-limit traffic without understanding token economics, while an LLM-aware gateway can route by model, token budget, or provider health. NVIDIA NeMo Switchyard is positioned around intelligent model routing, but a team should verify current capabilities, deployment requirements, and pricing rather than assuming that every orchestration framework is a complete production gateway.

The decisive question is where the bottleneck lies. If the gateway is overloaded, upstream provider concurrency will need to be constrained. If the provider is overloaded, retries and fallback traffic may make the incident worse. If a specific agent generates excessive tool calls, the correct remedy may be application policy rather than more gateway capacity. Load testing can expose that separation, but only if client, gateway, network, and provider timings are visible.

Common Mistakes That Distort LLM Gateway Tests

The most damaging mistake is testing a proxy while ignoring the inference provider’s shared quota. Provider limits often apply per account, organization, project, model, region, or a combination of those boundaries. Sending 500 concurrent requests to one model may trigger throttling before the gateway reaches its own CPU limit. Document actual quotas, obtain written clarification where necessary, and separate provider capacity tests from gateway-only tests. A second gateway test can use controlled mock upstreams with fixed first-token and generation delays, which is useful for isolating proxy behavior without buying excessive model usage.

Another mistake is allowing retries to conceal failure. A gateway with three attempts per request can turn 100 client requests into as many as 300 upstream attempts when a provider returns 429 responses. Retries should use exponential backoff with jitter, respect Retry-After headers, and operate within a strict attempt and time budget. Load tests should show both client-visible success and raw upstream attempt volume. Caching, batching, request coalescing, and fallback routing also change workload shape, so enable and measure each mechanism explicitly.

Teams frequently test unrealistic token settings. A 128K-token context window is a maximum capability, not a normal traffic distribution. Likewise, requesting the maximum output for every prompt wastes money and extends connection duration. Use production percentiles, with a smaller number of long-context boundary tests. Avoid measuring only completed requests when streaming clients may disconnect early, and do not count authentication failures as successful capacity. A client timeout below the gateway timeout can create duplicate work unless cancellation propagates correctly.

Finally, do not extrapolate from one geography, model, or five-minute window. Network paths, provider regions, model availability, and rate limits change. Record the date, gateway version, configuration, model versions, region, concurrency profile, and token assumptions with every result. A benchmark without those details is an anecdote rather than reusable engineering evidence.

When to Act and What It May Cost

Run an initial load test before production launch if the gateway will make routing decisions, manage multiple providers, or impose rate limits. That is especially important for interactive chat, coding assistants, and autonomous agents because they combine streaming, long sessions, variable context, and potentially repeated tool calls. A monthly internal application with low, stable demand may be adequately assessed through limited testing and provider sandbox limits, but a production agent platform should undergo staged testing, failover exercises, and periodic soak tests.

Repeat capacity testing after material changes to the gateway, network topology, model provider, token policy, or traffic mix. A quarterly review is a reasonable starting cadence, while daily or per-release regression tests may suit rapidly changing platforms. If p95 latency rises by more than 20%, error rates exceed the agreed 1% ceiling, or provider 429 responses exceed 2%, investigate before scaling traffic. These triggers are examples, not universal guarantees.

Testing costs depend on traffic, model prices, duration, and whether real providers or mocks are used. A gateway itself may be available through open-source deployment or a managed subscription, while inference is usually billed by input and output tokens. A focused proof of concept might use a few hundred requests and cost tens of dollars; a multi-hour stress test with long contexts can cost hundreds or thousands. Keep token budgets explicit, cap maximum output, cancel abandoned streams, and use mocks for gateway-only tests. In September 2026, prices and quotas should be checked directly with vendors because models, regions, discounts, and rate-limit policies change frequently.

The Recommended Decision

The definitive approach is a layered test: establish production telemetry, reproduce the real token and streaming distribution, isolate the gateway with controlled mocks, then verify the complete path against real providers under bounded budgets. Use staged concurrency, p50/p95/p99 latency, time to first token, errors, throttling, queue behavior, retry volume, and cost per successful request. Do not use a single requests-per-second headline as the capacity number, because long generations can achieve the same RPS while consuming far more compute and keeping connections open.

Proceed to higher load only while queue depth, latency, and memory remain stable. Stop at the first sustained breach of a documented service objective, analyze the failing layer, and correct the configuration before rerunning. For most B2B applications, the first actionable boundary is not the gateway’s advertised maximum but the point where p95 latency, throttling, or cost rises faster than useful throughput. That measured boundary, documented on a specific date and with a known workload, is far more useful than an unsupported claim that one gateway is “31 times” faster than another.