GraphQL Benchmarks

January 25, 2025 ยท View on GitHub

Open in GitHub Codespaces

Explore and compare the performance of the fastest GraphQL frameworks through our comprehensive benchmarks.

Introduction

This document presents a comparative analysis of several renowned GraphQL frameworks. Dive deep into the performance metrics, and get insights into their throughput and latency.

NOTE: This is a work in progress suite of benchmarks, and we would appreciate help from the community to add more frameworks or tune the existing ones for better performance.

Quick Start

Get started with the benchmarks:

  1. Click on this link to set up on GitHub Codespaces.
  2. Once set up in Codespaces, initiate the benchmark tests:
./setup.sh
./run_benchmarks.sh

Benchmark Results

QueryServerRequests/secLatency (ms)Relative
1{ posts { id userId title user { id name email }}}
Tailcall22,805.004.30214.34x
async-graphql1,080.8891.8610.16x
GraphQL JIT1,038.8395.789.76x
Caliban902.18110.948.48x
Gqlgen400.68246.333.77x
Netflix DGS191.44506.581.80x
Apollo GraphQL133.94687.141.26x
Hasura106.40824.181.00x
2{ posts { title }}
Tailcall36,300.302.6982.05x
Caliban5,554.8018.0712.55x
async-graphql5,296.1118.9011.97x
Gqlgen1,112.4498.532.51x
GraphQL JIT1,066.5593.572.41x
Apollo GraphQL896.38112.082.03x
Netflix DGS818.73149.691.85x
Hasura442.44226.861.00x
3{ greet }
Caliban47,657.702.0430.11x
Tailcall46,811.102.0929.57x
Gqlgen25,725.904.9116.25x
async-graphql25,616.503.9216.18x
GraphQL JIT4,434.1922.512.80x
Netflix DGS4,119.7927.302.60x
Apollo GraphQL4,071.1027.922.57x
Hasura1,583.0064.751.00x

1. {posts {title body user {name}}}

Throughput (Higher is better)

Throughput Histogram

Latency (Lower is better)

Latency Histogram

2. {posts {title body}}

Throughput (Higher is better)

Throughput Histogram

Latency (Lower is better)

Latency Histogram

3. {greet}

Throughput (Higher is better)

Throughput Histogram

Latency (Lower is better)

Latency Histogram

Architecture

Architecture Diagram

A client (wrk) sends requests to a GraphQL server to fetch post titles. The GraphQL server, in turn, retrieves data from an external source, jsonplaceholder.typicode.com, routed through the nginx reverse proxy.

WRK

wrk serves as our test client, sending GraphQL requests at a high rate.

GraphQL

Our tested GraphQL server. We evaluated various implementations, ensuring no caching on the GraphQL server side.

Nginx

A reverse-proxy that caches every response, mitigating rate-limiting and reducing network uncertainties.

Jsonplaceholder

The primary upstream service forming the base for our GraphQL API. We query its /posts API via the GraphQL server.

GraphQL Schema

Inspect the generated GraphQL schema employed for the benchmarks:

schema {
  query: Query
}

type Query {
  posts: [Post]
}

type Post {
  id: Int!
  userId: Int!
  title: String!
  body: String!
  user: User
}

type User {
  id: Int!
  name: String!
  username: String!
  email: String!
  phone: String
  website: String
}

Contribute

Your insights are invaluable! Test these benchmarks, share feedback, or contribute by adding more GraphQL frameworks or refining existing ones. Open an issue or a pull request, and let's build a robust benchmarking resource together!