High-Concurrency Load Testing and Rate Limiting Governance for Large Language Models

    This article examines the common failures that appear during the launch window of a new large language model, including rate limiting under concurrency, overload errors during peak traffic, and abnormally long reasoning chains. It breaks down the root causes across capacity, scheduling, and inference strategy, then presents a reproducible load testing plan, client-side rate limiting controls, targeted optimizations for long reasoning chains and tool calls, and observability and cost governance practices. Readers will find actionable steps and sample pseudocode for achieving stable and repeatable evaluation results under high concurrency.

    1. Background: Typical Failure Patterns During a New Model Launch Window

    In the early stage of a large language model service opening up, load testing often runs into three overlapping phenomena: requests get rate limited as soon as concurrency rises; requests queue up and then return overload errors; and a few requests experience abnormally long reasoning chains that take far longer than expected. The scenario described in the original text is representative: launching 6 concurrent tasks triggered account-level rate limiting; switching to serial execution then ran into a business peak, where roughly half of the requests with tool calls were rejected, while the same request worked normally when switched to the previous-generation model. The logs also showed a case where a single inference produced over a hundred thousand characters, took about 12 minutes, and ultimately returned only one sentence with a single tool call.

    These phenomena are not caused by a single factor, but by the combined effect of capacity, scheduling, and inference strategy. The following sections first break down the causes, then provide an actionable governance plan.

    2. Root Cause Breakdown

    2.1 Capacity and Quotas Are Hard Constraints

    In the initial period after a new model goes live, the available quota per unit time is usually counted per account and includes multiple dimensions such as requests per minute, tokens per minute, and concurrent connections. Being rate limited at just 6 concurrent requests indicates that the bottleneck is the quota rather than backend compute capacity.

    2.2 Queuing During Peak Hours Causes Overload

    Overload errors (commonly the 529 class of responses in the industry) are essentially queue overflow or protective rejection. During peak hours, the request arrival rate exceeds the service rate, and the system actively rejects requests to avoid an avalanche. The fact that the same request works on the previous-generation model indicates that a single request on the new model consumes more resources, so fewer requests can be served per unit time.

    2.3 Tool Calls Amplify Latency and Failure Rates

    Requests with tool calls require multiple round trips: the model produces the call intent, an external tool is executed, the result is fed back, and inference resumes. Each round consumes quota and time budget, and if any round is rate limited, the entire chain fails. As a result, the failure rate is significantly higher than for plain text requests.

    2.4 Overly Long Reasoning Chains Are a Cost and Latency Amplifier

    When the inference strategy leans toward “think for a long time before answering,” the number of output tokens expands sharply. Over a hundred thousand characters of reasoning content not only stretches the time to first token and overall latency, but also consumes quota, creating a positive feedback loop where “the slower it gets, the more likely it is to be rate limited.”

    3. Load Testing Plan Design: Make the Conclusions Reproducible First

    The most common reason load testing fails is not that the service is inadequate, but that the method is wrong. The following steps are recommended:

    1. Define the objective: whether you are testing throughput, latency distribution, or tool call success rate, since the three have different metrics.
    2. Fix the variables: model version, sampling parameters such as temperature, maximum output length, whether tools are enabled, and the prompt template should all be held constant.
    3. Apply stepped load: increase from 1 concurrency step by step to the target concurrency, holding each level for a sufficient duration and observing the inflection point.
    4. Record rejection reasons: distinguish rate limiting, overload, timeout, and content filtering, and avoid lumping them together.
    5. Double-person review: run the same script once at different time periods to confirm the conclusions are stable.

    A sample client skeleton (pseudocode):

    1. # Serial baseline + stepped concurrency + unified error classification
    2. async def run_case(prompt, tools=None, max_tokens=1024):
    3. for attempt in range(MAX_RETRY):
    4. try:
    5. return await client.chat(prompt, tools=tools, max_tokens=max_tokens)
    6. except RateLimited:
    7. await sleep(backoff(attempt)) # exponential backoff + jitter
    8. except Overloaded:
    9. await sleep(queue_wait(attempt)) # queue and wait instead of retrying immediately
    10. except Timeout:
    11. return {"error": "timeout"}
    12. return {"error": "exhausted"}

    4. Rate Limiting Governance: Four Gates on the Client Side

    4.1 Token Bucket Shaping

    Maintain a token bucket on the client, set the refill rate according to the quota, and have requests take a token before being sent, smoothing burst traffic into steady traffic.

    4.2 Concurrency Cap and Semaphore

    Use a semaphore to limit the number of in-flight requests, preferring to queue rather than trigger account-level rate limiting. The concurrency should be set to about 70% of the measured inflection point.

    4.3 Backoff and Jitter

    Retries must include exponential backoff and random jitter to avoid all failed requests retrying collectively at the same moment and creating a secondary impact. For overload errors, prefer “wait and retry”; for rate limiting errors, prefer “slow down.”

    4.4 Priority and Degradation

    Split requests into two categories, online interactive and offline batch. During peak hours, prioritize online requests; offline tasks automatically slow down or are rescheduled, and when necessary, degrade to the previous-generation model or a smaller-parameter model.

    5. Targeted Optimization for Long Reasoning Chains and Tool Calls

    • Limit the output budget: explicitly set the maximum output tokens to prevent reasoning content from expanding without bound.
    • Segmented reasoning: split complex tasks into three stages, planning, execution, and summarization, with a separate budget and timeout for each stage.
    • Tool call convergence: allow only one tool call at a time, and decide whether to continue after the result is fed back, avoiding multiple parallel tools that amplify the failure surface.
    • Caching and reuse: cache repeated prompts and tool results to reduce ineffective round trips.
    • Timeout budget allocation: set a total budget for the entire chain, allocate it by stage, and terminate immediately when the budget is exceeded, returning partial results.

    6. Observability and Cost Governance

    The core metrics to collect include request volume, success rate, rate limiting rate, overload rate, time to first token, overall latency, input and output token counts, number of tool call rounds, and cost per request. It is recommended to unify logs, metrics, and distributed tracing into a logging service and a monitoring and alerting system, and to set threshold alerts for the rate limiting rate and timeout rate.

    On the cost side, a dual control of “budget plus quota” can be adopted: set a daily token budget for each business line, and automatically slow down when approaching the threshold; separately attribute and charge for requests with overly long outputs, making it easier to locate abnormal callers.

    7. Conclusion

    The load testing conclusions during a new model launch window depend on whether the method is rigorous rather than on luck. By treating quotas as hard constraints, shaping concurrency, applying backoff to retries, budgeting reasoning chains, converging tool calls, and combining these with a complete observability system, you can obtain stable and reproducible evaluation results during peak hours. If you build your own inference or need elastic capacity, you can build the load testing and governance pipeline by combining general cloud product capabilities such as container platforms, object storage, message queues, and monitoring and alerting. The relevant general capabilities of Baidu AI Cloud can serve as one reference option.