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.

Also check out benawad/node-graphql-benchmarks for more benchmarks.

Result

Machine: Linux 4.19.128-microsoft-standard x86_64 | 12 vCPUs | 13GB Node: v15.6.0

LibraryRequests/sLatency
benzene-http+uWebSockets16391.36010.0061
benzene-http15314.39870.0065
mercurius13583.73020.0074
apollo-server2727.68870.0366
express-graphql2443.09610.0408
graphql-helix2238.39560.0445