Home

Awesome

GraphQL Benchmarks <!-- omit from toc -->

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

<!-- PERFORMANCE_RESULTS_START -->
QueryServerRequests/secLatency (ms)Relative
1{ posts { id userId title user { id name email }}}
Tailcall21,657.404.61182.79x
GraphQL JIT1,129.2688.059.53x
async-graphql1,021.0297.238.62x
Caliban776.59128.886.55x
Gqlgen380.13259.193.21x
Netflix DGS191.22507.461.61x
Apollo GraphQL129.96706.991.10x
Hasura118.48765.261.00x
2{ posts { title }}
Tailcall32,656.803.0675.85x
async-graphql5,216.9719.1812.12x
Caliban4,833.9521.2311.23x
GraphQL JIT1,163.4185.782.70x
Gqlgen1,099.1399.672.55x
Apollo GraphQL901.74111.142.09x
Netflix DGS822.76122.711.91x
Hasura430.55236.281.00x
3{ greet }
Tailcall38,779.102.5827.26x
Caliban33,484.103.0223.54x
async-graphql24,076.704.1516.92x
Gqlgen23,968.909.9616.85x
GraphQL JIT4,550.4321.933.20x
Netflix DGS4,311.4127.843.03x
Apollo GraphQL4,020.7828.052.83x
Hasura1,422.6171.801.00x
<!-- PERFORMANCE_RESULTS_END -->

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!