Benchmarks

Benchmarks

A basic HTTP benchmarks against @benzene/http and popular GraphQL Server libraries using rakyll/hey.

http is preferred over express where applicable because express adds overhead (See fastify/benchmarks).

Results are taken after a 5s warm-up. Then the following command is used.

hey -c 100 -z 8s -D body.txt -T application/json -m POST http://localhost:4000/graphql

Remember, this benchmark is for reference only and by no means says that one is better than the others. The slowest part of the application is still the application code itself, not the library.

How to use

Clone the repository, go to benchmarks folder, and install the dependencies.

git clone https://github.com/hoangvvo/benzene.git
cd benzene/benchmarks
npm i

Install rakyll/hey

Run the benchmarks (for Windows, use git bash):

Set permissions:

chmod u+x ./run
chmod u+x ./runall

Run benchmarks:

./run <library>

The following can be used as <library>:

To run all benchmarks at once:

./runall

Create a PR to add one.

To create a markdown table from the result:

./runall > results.txt
node hey-to-table.js

Result

Machine: Linux 5.17.0-051700-generic x86_64 | 12 vCPUs | 16GB Node: v18.7.0

LibraryRequests/sLatency
benzene-jit-http18605.65660.0054
mercurius15734.24450.0064
benzene-http11131.16070.009
graphql-yoga6410.06530.0156
apollo-server3992.50570.025
graphql-helix2456.53160.0406
express-graphql2138.0870.0466