GraphQL DDoS is usually described as an HTTP flood that happens to target a GraphQL endpoint. That holds only for the crudest version. The effective one sends few requests, each doing the work of many, and a DDoS test exists to find out whether your limits count requests or count the work. It is an application-layer denial-of-service attack in which the cost lives inside the query, not in the request rate.
How GraphQL DDoS works
The general pattern, valid requests that are collectively too expensive, is the application-layer attack. GraphQL changes the arithmetic because the client, not the server, decides how much work a request contains. Three features make that possible.
Batching. Many GraphQL servers accept an array of operations in one HTTP request. Ten operations or a thousand, the proxy and the rate limiter see one POST.
Aliases. A single query can ask for the same field many times under different names. Each alias runs the resolver again. This works even where batching is switched off, which is why disabling batching alone does not close the hole.
Nesting. Fields that return lists can contain fields that return lists. Each level multiplies the work of the level above, so a query a few lines long can expand into a very large number of resolver calls and database reads.
There is also less for the edge to work with. Most GraphQL APIs expose one path, usually reached by POST, so a per-path rule cannot tell a cheap query from a ruinous one, and a cache keyed on the URL cannot absorb any of it.
Why it matters under attack
A request-rate limit sees one hit. Rate limiting by requests per client was built for a world where one request is roughly one unit of work. Here, a client well under any sensible request threshold can still keep the database saturated.
Rejection has to happen before execution. A timeout that fires after the resolvers have already run protects the response, not the backend. The database queries were issued; the cost was paid. The only cheap rejection is one made from the query's shape before anything resolves.
The traffic looks normal. Low request rates, valid syntax, real fields, often from authenticated clients. Like a HashDoS payload, the damage comes from what the server does with an ordinary-looking input, so volume-based detection has nothing to trigger on.
Hardening, and what a DDoS test measures
The controls all limit work rather than requests:
- Cap batch size, alias count and query depth. Set the limits from what your own clients actually send; there is no standard number.
- Compute a cost per query from its fields and list sizes, reject anything over budget before execution, and rate-limit clients on cost spent rather than requests made.
- Set execution timeouts on resolvers and on the whole operation, as a backstop.
- Restrict first-party clients to known queries where you can, so the server runs only the operations your own apps were built with.
A test then sends a range of query shapes at a controlled rate: cheap ones, and ones that grow by batching, by aliases and by depth. For each, it records the request rate the edge saw against the resolver calls and database load the backend did. The key check is that an over-limit query is refused before any resolver runs, which shows up as flat backend metrics while rejections climb.
It also checks the error path. A rejection that is itself slow, or that logs the full query body at volume, can become the next bottleneck. How cost per endpoint class, rather than raw request rate, drives the rest of an API test plan is covered in DDoS testing for APIs.