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/graphqlRemember, 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 iRun the benchmarks (for Windows, use git bash):
Set permissions:
chmod u+x ./run
chmod u+x ./runallRun benchmarks:
./run <library>The following can be used as <library>:
benzene-jit-http(@benzene/httpwith JIT runtime)benzene-http(@benzene/http)apollo-servermercurius(with JIT)graphql-yogagraphql-helixexpress-graphql
To run all benchmarks at once:
./runallCreate a PR to add one.
To create a markdown table from the result:
./runall > results.txt
node hey-to-table.jsResult
Machine: Linux 5.17.0-051700-generic x86_64 | 12 vCPUs | 16GB Node: v18.7.0
| Library | Requests/s | Latency |
|---|---|---|
| benzene-jit-http | 18605.6566 | 0.0054 |
| mercurius | 15734.2445 | 0.0064 |
| benzene-http | 11131.1607 | 0.009 |
| graphql-yoga | 6410.0653 | 0.0156 |
| apollo-server | 3992.5057 | 0.025 |
| graphql-helix | 2456.5316 | 0.0406 |
| express-graphql | 2138.087 | 0.0466 |