API Concurrency Limits: How Developers Should Design Request Strategies

    This article distinguishes RPM, TPM, RPD, and concurrency limits, explains why rate limits and concurrency limits behave differently for long-running requests, and introduces Little's Law as a capacity-planning tool. It also covers the engineering rationale for server-side concurrency limits.

    1. Distinguish Common Request Limits

    When calling model services, platforms typically set multiple quotas. Developers most commonly encounter the following four types:

    • Requests per minute (RPM): The total number of requests that can be initiated within a unit of time. This measures request frequency.
    • Tokens per minute (TPM): The total number of input and output tokens within a unit of time. This measures computation volume.
    • Requests per day (RPD): The daily request cap. This is often used to control total usage and cost.
    • Concurrency: The number of requests still being processed at the same moment. This measures instantaneous occupancy.

    The first three describe a cumulative amount within a unit of time. The fourth focuses on “right now.” Understanding this distinction is a prerequisite for designing a correct request strategy.

    2. Rate Limits vs. Concurrency Limits

    Rate limits count how many requests were sent within a time window. Concurrency limits count how many requests have not yet finished at a given moment.

    The difference is most obvious with long requests. Assume the concurrency quota is 100:

    • If each request takes 1 second, about 100 requests per second can theoretically be processed.
    • If each request takes 60 seconds, such as long-form text generation or streaming output, the same 100 slots can start only about 1.7 new requests per second.

    In the second case, throughput is determined by request duration, not by how fast requests are sent. Even if the sender does not exceed the requests-per-minute limit, it may still receive a rejection response because concurrency slots are full.

    There is a general mathematical relationship between these two metrics, known as Little’s Law:

    Average concurrency ≈ request arrival rate × average duration of a single request

    This formula is independent of any specific platform and is a basic tool for capacity planning. Developers can use it to estimate how much concurrency their workloads require.

    3. Why Servers Limit Concurrency

    From an engineering perspective, inference requests are tasks that occupy resources in real time. A request occupies resources from the time it is received until its output is produced.