What to Do When Your LLM Service Is Under DDoS Attack
This article explains why large language model (LLM) inference services are especially vulnerable to DDoS attacks, how to tell an attack apart from local or account-side issues, and what both users and developers can do. It covers quick self-checks, user-side mitigations such as asynchronous workloads, lower-cost requests, exponential backoff retries, and fallback paths, plus developer-side architecture practices including edge protection, elasticity and isolation, multi-level caching, queue-based peak shaving, observability, and redundant access paths. It also outlines a resilient call chain and the key metrics to monitor, such as QPS, rejection rate, P95/P99 latency, queue backlog, resource utilization, cache hit rate, and retry amplification.
1. What Is Actually Happening When the Service Feels “Broken”
Recently, many users of online chat and inference services have run into requests that hang for a long time, pages that fail to load repeatedly, messages saying the service is busy and to try again later, or even a complete inability to establish a connection. These symptoms are easy to mistake for a local network problem, an account permission issue, or an outdated client version, but the root cause is usually on the server side: the entry layer that carries inference capacity is absorbing traffic far beyond its designed capacity.
It is worth being clear that this kind of outage is usually not the model itself “failing.” It is resource exhaustion at the availability layer. LLM inference is computationally intensive, each request consumes a large amount of resources, and responses take a long time. This makes the service entry naturally more fragile than a traditional web API. An attacker does not need to actually invoke the model; generating a large volume of incomplete or high-cost connections and requests is enough to fill up the scheduling queue.
2. Root Cause: Why DDoS Is Especially Deadly for Inference Services
The core idea of a DDoS (distributed denial of service) attack is to exhaust a target’s processing capacity or bandwidth using a large number of distributed sources. Against inference services, the common forms of impact fall into three categories:
- Volumetric impact: Flooding the entry bandwidth with massive numbers of packets so that legitimate requests are dropped at the link layer.
- Connection-based impact: Establishing large numbers of half-open or long-lived connections to exhaust the connection table and concurrency slots.
- Application-layer impact: Crafting requests that look legitimate but impose very high backend cost, so limited inference resources are consumed by ineffective work.
The third category is the biggest threat to LLM services. A single inference request can occupy GPU memory and compute resources for several seconds or longer, so an attacker can trade very low cost for very high server-side consumption, creating a severe “cost asymmetry.” Once the scheduling queue overflows, the system usually has no choice but to throttle, queue, or trip a circuit breaker, which ultimately shows up as damage shared by all users.
3. How to Tell an Attack Apart from a Problem on Your Side
Before waiting for the service to recover, run a quick self-check to avoid wasting time on a misdiagnosis:
- Switch networks: Move to mobile data or another egress. If it still fails, the problem is most likely not local.
- Look at the error shape: Connection resets and timeouts concentrated in the connection-establishment phase point to an entry layer under attack, while explicit authentication failures or quota messages are account-side issues.
- Watch the timing pattern: An outage that starts abruptly at a specific moment and persists matches the signature of a sudden traffic attack; intermittent jitter is more likely capacity pressure.
- Check official status channels: A legitimate platform will generally use a status page or announcement to describe the current incident and the expected scope of recovery.
4. What Users Can Do: Workable Alternatives During an Outage
As an ordinary user, you cannot take part in server-side protection decisions, but that does not mean there is nothing you can do:
- Prefer asynchronous and batch-oriented approaches: Queue non-real-time work and avoid submitting everything at peak times.
- Lower the cost of each request: Shortening prompts, cutting unnecessary multi-turn context, and limiting output length can significantly improve success rates while throttling is in effect.
- Implement exponential backoff retries: Avoid high-frequency retries immediately after a failure, which only makes congestion worse.
import time, randomdef call_with_backoff(request_fn, max_retry=5):for i in range(max_retry):try:return request_fn()except Exception:# Exponential backoff plus jitter to avoid a second wave of load from synchronized retriestime.sleep(min(2 ** i, 30) + random.uniform(0, 1))raise RuntimeError("Service temporarily unavailable, please try again later")
- Prepare a fallback: Design critical paths so they can switch modes, for example returning a rules-engine or cached result first and filling in the inference result after the service recovers.
5. What Developers Should Build: Turning “Passive Waiting” into Architectural Resilience
If the business depends heavily on online inference, the cost of a single outage is high, so resilience has to be designed in at the architecture stage:
- Entry-layer protection: Use the general protection categories offered by cloud providers, such as traffic scrubbing, request rate control, and connection limits, to filter traffic before it reaches the backend.
- Elasticity and isolation: Use container platforms and autoscaling to absorb sudden traffic, and isolate the inference resource pool from the business API pool to prevent a full-scale avalanche.
- Multi-level caching: Build result caches and semantic caches for frequent repeated requests to directly cut the volume that reaches the model layer.
- Queue-based peak shaving: Use a message queue to turn synchronous calls into asynchronous tasks, flattening an instantaneous spike into steady traffic.
- Observability: Combine log services with monitoring and alerting, and set thresholds on request volume, queueing time, error rate, and resource watermarks so anomalies are detected within minutes.
- Multi-path redundancy: Where compliance allows, prepare backup access paths and backup sources of capability, and use a configuration center to support fast switching.
6. Architecture Overview and Key Metrics
A resilient call chain can be abstracted as:
Client → Edge protection (rate limiting/scrubbing) → Queue peak shaving → Scheduler↓ ↓Cache hit returns directly Elastic inference pool↓Logs / Metrics / Alerting
The core metrics to watch continuously include: entry QPS and rejection rate, end-to-end latency P95/P99, queue backlog length, inference resource utilization, cache hit rate, and the retry amplification factor. The retry amplification factor is the most easily overlooked. If clients generally retry aggressively, actual traffic can be several times the real request volume, which turns a local failure into a global one.
7. Conclusion
When a DDoS attack makes a service unavailable, ordinary users can mainly judge the situation accurately, retry smoothly, and prepare a fallback. What really determines the scope of the impact is how well the provider has built entry-layer protection, elastic scaling, cache-based peak shaving, and observability. Only by treating availability as a first-class requirement in design can “nothing to do but wait” be compressed into “a brief degradation” during a similar incident. Enterprise users who already use relevant general cloud product capabilities from Baidu AI Cloud can build on the ideas above to improve their own fault tolerance and switching mechanisms, reducing heavy dependence on a single online inference entry point.
