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
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>
:
apollo-server
benzene-http
(@benzene/http
)express-graphql
mercurius
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
Library | Requests/s | Latency |
---|---|---|
benzene-http+uWebSockets | 16391.3601 | 0.0061 |
benzene-http | 15314.3987 | 0.0065 |
mercurius | 13583.7302 | 0.0074 |
apollo-server | 2727.6887 | 0.0366 |
express-graphql | 2443.0961 | 0.0408 |
graphql-helix | 2238.3956 | 0.0445 |