Skip to content

Latest commit

 

History

History
167 lines (119 loc) · 5.2 KB

README.md

File metadata and controls

167 lines (119 loc) · 5.2 KB

GraphQL Benchmarks

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

Query Server Requests/sec Latency (ms) Relative
1 { posts { id userId title user { id name email }}}
Tailcall 21,836.10 4.57 216.08x
GraphQL JIT 1,079.08 92.09 10.68x
async-graphql 1,000.33 99.26 9.90x
Caliban 776.54 130.43 7.68x
Gqlgen 383.12 256.93 3.79x
Netflix DGS 188.47 513.21 1.86x
Apollo GraphQL 128.98 710.21 1.28x
Hasura 101.06 805.36 1.00x
2 { posts { title }}
Tailcall 33,418.20 2.99 86.89x
async-graphql 5,170.59 19.34 13.44x
Caliban 4,789.83 21.37 12.45x
Gqlgen 1,104.60 98.75 2.87x
GraphQL JIT 1,101.46 90.63 2.86x
Apollo GraphQL 876.23 114.44 2.28x
Netflix DGS 805.56 124.81 2.09x
Hasura 384.58 262.54 1.00x
3 { greet }
Tailcall 39,980.30 2.50 28.69x
Caliban 33,530.80 2.98 24.06x
Gqlgen 24,096.40 9.76 17.29x
async-graphql 23,638.30 4.25 16.96x
GraphQL JIT 4,521.03 22.07 3.24x
Netflix DGS 4,163.31 28.63 2.99x
Apollo GraphQL 4,012.90 27.68 2.88x
Hasura 1,393.46 71.42 1.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!