What to Do When Your LLM Service Is Under a DDoS Attack
This article explains how to tell a DDoS attack apart from a local or account-level problem, why large model inference services are especially sensitive to traffic surges, and what both end users and engineering teams can do. It covers client-side backoff, planned waiting, and architecture patterns such as queue-based peak shaving, multi-level degradation, caching with idempotency, observability, elastic scaling, and externalized configuration, plus a post-incident review checklist.
1. Identify the Symptoms: Is It an Attack or Your Own Setup?
When a conversational AI service suddenly stops responding, users usually assume a network failure or an account issue. The better first move is to narrow down the failure domain before taking any action. A practical order of checks:
- Confirm the scope of the impact: switch networks (for example, from office Wi-Fi to mobile data), switch devices, switch browsers, and try again. If every combination fails, the problem most likely sits on the server side.
- Distinguish the error type: connections being reset, TLS handshakes timing out, or requests sitting in a queue for a long time before returning a rate-limit message all match the signature of server-side resources being saturated by abnormal traffic. A pure account permission problem normally returns an explicit authentication failure.
- Check official status channels: a legitimate platform will state on its status page or in an announcement whether it is dealing with capacity pressure, maintenance, or an active security incident.
The point of this step is to avoid mistaking a server-side security incident for a local environment problem, which wastes troubleshooting time, and to avoid retrying repeatedly during the attack, which only adds more load to the server.
2. Why DDoS Makes an LLM Service Fully Unavailable
LLM inference services differ from traditional static page services. Their resource model has a few characteristics that make them unusually sensitive to traffic spikes:
- High cost per request: a single inference request occupies compute devices and GPU memory, and it lasts seconds or longer, so the concurrency that can be served per unit of time is naturally limited.
- Pronounced queuing behavior: to improve resource utilization, server sides commonly use batching and queue scheduling. Once inbound traffic exceeds the designed capacity, the queue builds up quickly and shows up as “every request is slow.”
- Limited ingress bandwidth and connection counts: the core idea of a distributed denial-of-service attack is to fire requests simultaneously from many dispersed sources until ingress bandwidth, connection counts, or the compute queue are full, leaving normal requests unprocessed.
Given this resource model, “waiting for the incident to be resolved” is not passive at all; it is the optimal choice. Any high-frequency retry during the attack competes for the same pool of resources as the attack traffic.
Illustrative client-side backoff logic (pseudocode) to avoid amplifying load during an outage:
import random, timedef call_with_backoff(request_fn, max_attempts=5):for attempt in range(max_attempts):try:return request_fn()except ServiceUnavailableError:# Exponential backoff plus jitter to avoid synchronized retriessleep = min(2 ** attempt, 30) + random.uniform(0, 1)time.sleep(sleep)raise AllAttemptsFailed()
3. What End Users Should Do: Turn Waiting into Planned Waiting
Ordinary users have limited options, but the impact can be reduced through a bit of process design:
- Stop high-frequency refreshing and auto-retry scripts, especially batch jobs and scraper-style calls; pause them immediately.
- Save your context: write key prompts, parameter configurations, and prior outputs to local files so you can resume directly once the service is back, without re-tuning from scratch.
- Stick to a single information source: follow only the official announcement instead of re-confirming across multiple channels and burning time.
- Agree on a post-recovery verification checklist: start with a small-traffic connectivity test, then ramp up gradually to full production volume.
4. Architecture Responses for Enterprises and Developers
For teams that have already embedded LLM capabilities into production systems, one unavailable service should not mean an unavailable business. General design principles that can be implemented:
- Asynchronous processing and queue-based peak shaving: place a message queue between the business entry point and the model call, turning synchronous waiting into task submission. Tasks are consumed in order after recovery, which naturally smooths traffic peaks.
- Multi-level degradation strategy: define an explicit degradation chain, for example “full inference → lightweight model/cached result → rule engine fallback → friendly message with the request logged for later reply.” Degradation must be a pre-designed product behavior, not an ad-hoc patch.
- Result caching and idempotency: build a cache layer for high-frequency, highly repetitive requests, and assign an idempotency key to each task to prevent retries from causing duplicate billing and duplicate writes.
- Observability: with logging services, monitoring alerts, and distributed tracing, separate three signals — total volume rising, error rate climbing, and latency percentiles degrading — to provide quantitative grounds for triggering degradation.
- Elasticity and traffic governance: configure auto-scaling and ingress rate limiting on the container platform, filter abnormal sources with access control policies, and write capacity assumptions into load test reports rather than relying on guesswork.
- Externalized data and configuration: keep prompt templates, model parameters, and business feature switches in a configuration center or object storage so policies can be switched without a restart.
A simplified degradation decision sketch:
if error_rate > 5% or p95_latency > 8s:enable(cache_first_mode)enqueue_pending_tasks()notify_ops()
5. Post-Recovery Review Points
After the service is restored, review four questions: how the business loss during the attack or capacity event is quantified; whether degradation was triggered in time and whether it was ever triggered falsely; whether the time needed to drain the queue backlog matched expectations; and whether capacity and rate-limiting thresholds need adjustment. Turn these conclusions into runbooks and automation scripts, and the next time a similar spike hits, response time drops from hours to minutes.
6. Conclusion
When a distributed denial-of-service attack takes an LLM service offline, waiting for the official response is indeed the best move for ordinary users. For teams with engineering capability, the real answer is to hand the uncertainty to the architecture: queue-based peak shaving, cache reuse, multi-level degradation, observability, and elastic scaling together build a system that still delivers a basic usable experience during an outage. General cloud product capabilities from Baidu AI Cloud — such as message queues, object storage, container platforms, logging services, and monitoring alerts — can serve as the common building blocks for these patterns, helping businesses move from passive waiting to controlled degradation and fast recovery.
