This repo maintains configuration to benchmark various GraphQL ORMs/backends (hasura, postgraphile, prisma). The database used is a Postgres variant of Chinook. The benchmarking tool used is graphql-bench.
You'll need to have docker
and curl
to run these benchmarks
-
Clone the repo.
git clone https://github.com/hasura/graphql-backend-benchmarks.git && cd graphql-backend-benchmarks
-
Setup the graphql servers that you are interested in.
./hasura/manage.sh init ./prisma/manage.sh mysql init ./postgraphile/manage.sh init
-
Define the queries that you would like to benchmark in
hasura/queries.graphql
,prisma/queries.graphql
,postgraphile/queries.graphql
. There are few queries that already exist. -
Define a benchmark (checkout sample.bench.yaml) say bench.yaml.
-
Run the benchmark
cat bench.yaml | docker run -i --rm -p 8050:8050 -v $(pwd):/graphql-bench/ws hasura/graphql-bench:0.3
or run a benchmark on a sample query
cat sample.bench.yaml | docker run -i --rm -p 8050:8050 -v $(pwd):/graphql-bench/ws hasura/graphql-bench:v0.3 --query artistByArtistId
This opens up a http server at http://127.0.0.1:8050 which displays the results of the benchmark.
-
Tear down the setup
./hasura/manage.sh nuke ./prisma/manage.sh mysql nuke ./postgraphile/manage.sh nuke
When the above benchmark is run, the results on an i7-4710HQ CPU, 8GB RAM, SSD machine are as follows: