Performance Benchmarks
These benchmarks are based on the fastify benchmarks repo! in fact our goal is to perform similar to fastify as we considered it the industry standard in terms of performance.
mion is focused on being lightweight and fast so it can be run in serverless environments. We run the benchmarks before every PR gets merged to ensure there is no performance regression.
Please always take benchmarks as general guidelines as you might obtain different results in your real world application. we just run the benchmarks to ensure there is no performance degradation when new features/fixes are added to mion.
What is tested?
This is a simple hello world scenario, this is a good indicator of the routing overhead and theoretical upper limit of each framework.
// ### mion ###
export const routes = {
sayHello: (): string => ({hello: "world"}),
} satisfies Routes;
// ### Express ###
app.get("/sayHello", function (req, res) {
res.json({ hello: "world" });
});
Benchmarks
- Machine: darwin x64 | 8 vCPUs | 16.0GB Mem
- Node:
v18.17.0
- Run: Sat Oct 07 2023 14:22:34 GMT+0100 (Irish Standard Time)
- Method:
autocannon -c 100 -d 40.33 -p 10 localhost:3000
(two rounds; one to warm-up, one to measure)
Req (R/s)
Throughput (Mb/s)
Latency (ms)
Max Memory (Mb)
Memory Series (MB)
Results Table
Framework | Version | Router | Req (R/s) | Latency (ms) | Output (Mb/s) | Max Memory (Mb) | Max Cpu (%) | Validation | Description |
---|---|---|---|---|---|---|---|---|---|
mion.bun | 0.6.2 | โ | 58232.0 | 16.81 | 9.05 | 83 | 107 | โ | mion using bun, automatic validation and serialization |
http-node | 16.18.0 | โ | 35717.6 | 27.50 | 6.37 | 86 | 118 | โ | bare node http server, should be the theoretical upper limit in node.js performance |
fastify | 4.10.2 | โ | 31738.8 | 31.05 | 5.69 | 93 | 117 | - | Validation using schemas and ajv. schemas are generated manually or using third party tools |
mion | 0.6.2 | โ | 29064.0 | 33.90 | 5.82 | 96 | 121 | โ | Automatic validation and serialization out of the box |
deepkit | 1.0.1-alpha.75 | โ | 25878.0 | 38.14 | 4.61 | 186 | 135 | โ | Automatic validation and serialization out of the box |
hapi | 21.3.2 | โ | 23416.8 | 42.19 | 4.18 | 118 | 127 | โ | validation using joi or third party tools |
restify | 11.1.0 | โ | 10193.4 | 97.46 | 2.52 | 104 | 124 | โ | manual validation or third party tools |
express | 4.18.2 | โ | 7952.2 | 125.09 | 1.42 | 135 | 125 | โ | manual validation or third party tools |