Load test GraphQL APIs
GraphQL moves the cost to the query. One endpoint, endless shapes, and the expensive queries arrive only under load. Stresix sends the queries your clients send and watches how the resolver graph holds up.
Why query shape matters
A GraphQL endpoint is only as fast as its slowest resolver. Test the deep, nested queries and the ones that join across tables, because those are the ones that break under load.
How Stresix handles the traffic
The shooter runs k6 in Docker and hits the target over a private network. You keep the same headers, variables, and auth your app uses, and Stresix streams p50, p95, p99, throughput, and errors live.
The output you act on
The run ends with a recommended setup for the query mix you sent. If p95 climbs with resolver depth, you see it in the same run as the recommendation.
import http from 'k6/http';
import { check } from 'k6';
const query = JSON.stringify({
query: `query Feed($limit: Int!) {
feed(limit: $limit) {
id title author { name }
}
}`,
variables: { limit: 20 },
});
export const options = { vus: 500, duration: '5m' };
export default function () {
const response = http.post(
'https://your-app.example/graphql',
query,
{ headers: { 'Content-Type': 'application/json' } },
);
check(response, {
'status 200': (r) => r.status === 200,
'no errors': (r) => !JSON.parse(r.body).errors,
});
}Frequently asked questions
Can I load test an authenticated GraphQL endpoint?
Yes. Add the auth header or token logic in the k6 script and the target receives the same requests a real client would send.
What is the best way to measure GraphQL performance?
Send a realistic mix of shallow and deep queries, watch p95 and error rate as concurrency rises, and compare the same mix before and after schema changes.
Does Stresix support subscriptions?
The k6 script is yours, so any protocol k6 supports works, including WebSocket-based subscriptions.
Related guides
stop guessing your specs. start knowing them.
point stresix at a target and get the number you can deploy on, in one run.
Start a load test