Awesome
GraphQL Benchmarks <!-- omit from toc -->
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:
- Click on this link to set up on GitHub Codespaces.
- Once set up in Codespaces, initiate the benchmark tests:
./setup.sh
./run_benchmarks.sh
Benchmark Results
<!-- PERFORMANCE_RESULTS_START -->Query | Server | Requests/sec | Latency (ms) | Relative |
---|---|---|---|---|
1 | { posts { id userId title user { id name email }}} | |||
Tailcall | 20,544.40 | 4.85 | 170.47x | |
GraphQL JIT | 1,107.93 | 89.77 | 9.19x | |
async-graphql | 1,008.88 | 98.39 | 8.37x | |
Caliban | 765.62 | 130.24 | 6.35x | |
Gqlgen | 384.23 | 256.39 | 3.19x | |
Netflix DGS | 190.52 | 506.72 | 1.58x | |
Apollo GraphQL | 133.34 | 691.40 | 1.11x | |
Hasura | 120.51 | 736.92 | 1.00x | |
2 | { posts { title }} | |||
Tailcall | 32,700.50 | 3.05 | 74.06x | |
async-graphql | 5,163.62 | 19.43 | 11.70x | |
Caliban | 4,797.80 | 21.36 | 10.87x | |
GraphQL JIT | 1,132.02 | 88.16 | 2.56x | |
Gqlgen | 1,107.49 | 98.86 | 2.51x | |
Apollo GraphQL | 894.83 | 112.06 | 2.03x | |
Netflix DGS | 820.38 | 122.48 | 1.86x | |
Hasura | 441.51 | 229.88 | 1.00x | |
3 | { greet } | |||
Tailcall | 38,649.10 | 2.58 | 22.59x | |
Caliban | 33,650.00 | 2.98 | 19.66x | |
Gqlgen | 23,870.70 | 9.35 | 13.95x | |
async-graphql | 23,703.50 | 4.26 | 13.85x | |
GraphQL JIT | 4,460.01 | 22.37 | 2.61x | |
Netflix DGS | 4,240.90 | 28.06 | 2.48x | |
Apollo GraphQL | 4,084.51 | 27.57 | 2.39x | |
Hasura | 1,711.27 | 67.64 | 1.00x |
1. {posts {title body user {name}}}
Throughput (Higher is better)
Latency (Lower is better)
2. {posts {title body}}
Throughput (Higher is better)
Latency (Lower is better)
3. {greet}
Throughput (Higher is better)
Latency (Lower is better)
Architecture
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!