GraphQL Load Testing

Test your GraphQL resolvers under pressure

Send realistic GraphQL queries and mutations at scale. Identify slow resolvers, N+1 query problems, and connection pool exhaustion before they affect users.

What you get

  • Queries, mutations, and subscriptions
  • Variable parameterization
  • Authentication header injection
  • Per-operation latency tracking
  • Complexity-based testing scenarios
  • Works with Apollo, Hasura, and any GraphQL server
graphql-test.js
import http from 'k6/http';
import { check } from 'k6';

export const options = { vus: 50, duration: '3m' };

const query = `
  query GetProducts($limit: Int!) {
    products(limit: $limit) {
      id
      name
      price
      reviews { rating }
    }
  }
`;

export default function () {
  const res = http.post('https://api.example.com/graphql', 
    JSON.stringify({ query, variables: { limit: 20 } }),
    { headers: { 'Content-Type': 'application/json' } }
  );
  check(res, {
    'status 200': (r) => r.status === 200,
    'no errors': (r) => !JSON.parse(r.body).errors,
  });
}

Frequently Asked Questions

Can I test GraphQL subscriptions?

k6 supports WebSocket connections, so you can test GraphQL subscriptions over WebSocket. Use the k6/ws module to establish and maintain subscription connections.

How do I test different query complexities?

Create separate test scenarios with varying query depths and field selections. Use k6 stages to gradually increase complexity and VU count to find your server's limits.

Ready to start graphql load testing?

Sign up free — no credit card required. Get 200 VUs and 5 minute tests instantly.

loadtest.dev

© 2026 loadtest.dev