jkimbo / graphql-benchmarks

Benchmark tests for various GraphQL libraries

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GraphQL benchmarks

GraphQL benchmarking tool to test more realistic queries. It's highly inspired by Hasura's work on graphql-bench but with different design and goals in mind.

Gbench will use a config file to read the servers and queries to be executed.

Requirements

If you want to run gbench locally, you will need Python 3.7+, poetry, docker and k6 working locally.

poetry install
# For mac
brew install k6

Run benchmarks

poetry run python gbench.py

View dashboard

poetry run python dashboard.py

Config file

The Gbench config file is in a yaml format. It have two main sections: servers and queries.

The servers section indicates in which servers we are going to run the benchmark. Each server is built as a docker container that exposes a GraphQL endpoint on port 8000.

servers:
- name: Django + Graphene v3
  path: servers/django-graphene/

The queries section indicates all the different queries that we want to benchmark, in all servers.

queries:
- name: Top 250 rated movies
  # K6 benchmark file
  runner: queries/top-movies.js

Queries

Top 250 rated movies

Returns the top 250 rated movies on IMDB. Data comes from a sqlite database.

Query:

query {
  top250 {
    id
    imdbId
    title
    year
    imageUrl
    imdbRating
    imdbRatingCount
    director {
      id
      name
    }
}

About

Benchmark tests for various GraphQL libraries


Languages

Language:Python 92.3%Language:Dockerfile 4.2%Language:JavaScript 2.6%Language:Mako 0.8%