LLM Rate Limiting and High Availability: Capacity Governance for Shared AI Compute

    As AI inference compute becomes a scarce, shared resource, platforms are tightening free-tier usage and experiencing service interruptions. This article explains why LLM capacity planning differs from traditional web services, and how to build rate limiting, tiered quotas, availability metrics, client-side resilience, and capacity planning practices that keep applications stable under constrained compute. It includes token bucket pseudocode, SLI recommendations, and a developer action checklist.

    1. The Bigger Picture: From Free-Tier Limits to Shared Compute Governance

    A major LLM service platform was recently reported to be tightening usage limits on its web and mobile free tiers due to compute shortages—the first time it has restricted free users since launch. Over the same period, its official status page showed multiple service interruptions affecting the chat service and two model APIs. By monthly measurement, one API’s availability was around 99.46%, which translates to tens of hours of downtime per year; year to date, the platform has recorded dozens of outage and performance degradation incidents.

    Taken together, these numbers point to something broader than “one product is unstable.” They surface a universal engineering problem: when inference compute is a finite, shared resource, the service provider must re-price and re-allocate capacity between the scale that free access creates and the real compute cost behind each request. For developers, this signals a long-term trend: designing architectures that treat LLMs as an “infinite, constant, zero-latency” external dependency is becoming increasingly risky.

    This article does not discuss any specific vendor’s capabilities or pricing rules. It focuses on capacity governance and high-availability engineering methods that are common across the industry. The approaches below can be implemented on top of standard capabilities offered by general-purpose cloud platforms such as Baidu AI Cloud (container platforms, message queues, object storage, logging services, and monitoring/alerting).

    2. Why Compute Can “Suddenly” Run Short

    LLM inference has a fundamentally different resource model from a typical web service, and understanding that difference is the prerequisite for good capacity planning.

    • Unpredictable long-tail requests: Input and output lengths vary enormously, so the GPU memory and compute time a single request consumes follow a long-tail distribution. Averages tell you almost nothing about peak pressure.
    • GPU memory is a hard constraint: Batching improves throughput, but it requires reserved KV cache space. As concurrency rises, queueing latency degrades before throughput does.
    • Elasticity has lag: Scaling compute involves resource scheduling and model loading, with cold starts that take minutes or longer. It cannot absorb second-level traffic spikes.
    • Cost is non-linear: The marginal cost of free traffic is not zero, so “unlimited free” is neither commercially nor technically viable.

    The conclusion is direct: rate limiting is not a product defect; it is a necessary control plane for any shared-compute system.

    3. Tiered Quotas and Rate Limiting: Turning “Usage Cuts” into a Designed Mechanism

    Mature platforms typically split rate limiting into four layers, converging pressure step by step rather than shutting off entry points outright.

    1. Identity layer: Distinguish anonymous, registered-free, paid, and internal callers, binding each tier to different quotas and priority queues.
    2. API layer: Set separate rate limits for chat endpoints and model-invocation endpoints so that long-context conversations do not crowd out short requests.
    3. Tenant layer: Apply token buckets per principal to prevent a single source from flooding the system and dragging down the whole.
    4. Global layer: Set total concurrency and queue limits; requests that exceed them enter a wait or degraded state rather than failing outright.

    A minimal token bucket illustration (pseudocode, expressing semantics only):

    1. class TokenBucket:
    2. def __init__(self, capacity, refill_per_sec):
    3. self.capacity = capacity
    4. self.tokens = capacity
    5. self.refill = refill_per_sec
    6. self.last = now()
    7. def allow(self, cost=1):
    8. self.tokens = min(self.capacity,
    9. self.tokens + (now() - self.last) * self.refill)
    10. self.last = now()
    11. if self.tokens >= cost:
    12. self.tokens -= cost
    13. return True
    14. return False

    Engineering essentials: quotas must be observable and dynamically adjustable, delivered through a configuration center rather than hard-coded. Returning a clear, structured error with a suggested retry time for over-limit requests significantly reduces the secondary impact of blind client retries.

    4. Availability: What 99.46% Actually Means

    The 99.46% figure is a useful teaching example. Availability must be tied to a measurement window: computed monthly, 99.46% corresponds to roughly 0.54% × 30 days ≈ 3.9 hours of downtime; naively extrapolated across a year, that approaches 47 hours. Two common mistakes arise here:

    • Mixing measurement definitions: Counting “partial API degradation” as full unavailability, or conversely counting widespread timeouts as available, both distort the metric.
    • Averages hide the long tail: SLIs should be based on the ratio of successful requests and latency percentiles (such as P95/P99), not average response time.

    A recommended minimal metric set:

    • Request success rate (layered by API and by tenant)
    • Latency percentiles (P50/P95/P99)
    • Queueing time and rejection rate
    • Dependency-side error code distribution (rate limiting, timeouts, upstream unavailability)

    5. Client and Architecture Side: Keeping the Chain Stable Under Constrained Compute

    When server-side rate limiting tightens, client design determines whether the business “feels broken” to users.

    • Exponential backoff with jitter: Avoid simultaneous retries that cause a thundering herd.
    • Request budgets: Set a total timeout and maximum attempt count per business operation to prevent unbounded amplification.
    • Degradation chain: Small-parameter model → cached results → rule/template fallback → clear failure message.
    • Asynchronous processing: Move non-real-time generation into a message queue to smooth peaks, replacing long-lived connection waits with task-status queries.
    • Result caching: Apply semantic or exact caching to high-frequency, low-freshness requests to directly cut compute consumption.
    1. User request
    2. ├─ Cache hit ─────────────────► Return directly
    3. ├─ Cache miss & quota available ► Call inference API (with timeout and retry budget)
    4. ├─ Quota limited ─────────────► Enter queue, return task ID
    5. └─ Upstream unavailable ──────► Degraded template / friendly failure

    6. Capacity Planning: Putting a Fence Around Uncertainty

    • Load tests must reflect real distributions: Use request samples with real length distributions, not uniform small requests.
    • Plan capacity by percentiles, not averages: Use P95 load and peak concurrency as the scaling baseline, with headroom reserved for bursts.
    • Dual goals of cost and experience: Set an upper bound on per-request cost and a lower bound on experience, using monitoring and alerting to drive auto-scaling and quota adjustments.
    • Chaos drills: Regularly inject upstream timeouts and rate limiting to verify the degradation chain actually works.
    • Observability loop: Use a logging service to centrally collect call chains, and set alert thresholds on success rate and queueing time, forming a “detect—limit—scale—review” loop.

    7. Developer Action Checklist

    1. Starting today, add timeouts, retry budgets, and circuit breakers to all LLM calls;
    2. Build local caching and template fallbacks to turn “unavailable” into “degradable”;
    3. Use structured error codes to distinguish rate limiting from failures and guide client behavior;
    4. Replace averages with SLI/percentile metrics and recompute your own availability targets;
    5. Make non-real-time generation asynchronous, trading queues for peak smoothing;
    6. Run a dependency-failure drill each quarter and adjust quotas and capacity baselines accordingly.

    Compute scarcity will not disappear; it will shift from an “occasional incident” to a “constant constraint.” Only by designing rate limiting as a first-class citizen and validating degradation as the default path can you achieve truly controllable stability in the era of shared compute.