This repository compares the performance of some of the most popular web frameworks for Node.js against node:http
using bombardier.
bombardier -n 100000 -c 50 -p r http://127.0.0.1:3000
RELATIVE | FRAMEWORK | AVG | STDDEV | MAX |
---|---|---|---|---|
100% | uWS | 74036 |
5505 |
82590 |
86% | Hyper Express | 63418 |
2964 |
67126 |
37% | Node (Default) | 27275 |
7882 |
51754 |
33% | Fastify | 24470 |
7163 |
36126 |
28% | Hono | 20804 |
6007 |
30479 |
25% | Koa | 18212 |
5998 |
48618 |
11% | Carbon | 8248 |
1369 |
10324 |
9% | Express | 6421 |
1020 |
8442 |
-
import { listen } from '@sinclair/carbon/http' listen({ hostname: '127.0.0.1', port: 3000 }, () => { return new Response('Hello World', { status: 200, headers: { 'content-type': 'text/plain' } }) })
Statistics Avg Stdev Max Reqs/sec 8681.33 4333.09 59801.34 Latency 5.74ms 4.29ms 371.29ms HTTP codes: 1xx - 0, 2xx - 94034, 3xx - 0, 4xx - 0, 5xx - 0 others - 5966 Errors: dial tcp 127.0.0.1:3000: connect: connection refused - 5966 Throughput: 1.86MB/s
-
import express from 'express' const app = express() app.get('/', function (req, res) { res.send('Hello World') }) app.listen(3000)
Statistics Avg Stdev Max Reqs/sec 6522.26 1052.92 8395.78 Latency 7.66ms 3.66ms 348.16ms HTTP codes: 1xx - 0, 2xx - 100000, 3xx - 0, 4xx - 0, 5xx - 0 others - 0 Throughput: 1.87MB/s
-
import fastify from 'fastify' const app = fastify({ logger: false }) app.get('/', (req, res) => { res.send('Hello World') }) app.listen({ port: 3000 }, (err) => { if (err) throw err })
Statistics Avg Stdev Max Reqs/sec 25030.48 7666.59 37032.30 Latency 2.00ms 2.03ms 184.73ms HTTP codes: 1xx - 0, 2xx - 100000, 3xx - 0, 4xx - 0, 5xx - 0 others - 0 Throughput: 5.68MB/s
-
import { serve } from '@hono/node-server' import { Hono } from 'hono' const app = new Hono() app.get('/', (c) => c.text('Hello World')) serve(app)
Statistics Avg Stdev Max Reqs/sec 21722.45 6294.64 30018.85 Latency 2.30ms 2.02ms 181.69ms HTTP codes: 1xx - 0, 2xx - 100000, 3xx - 0, 4xx - 0, 5xx - 0 others - 0 Throughput: 4.91MB/s
-
import HyperExpress from 'hyper-express' const server = new HyperExpress.Server() server.get('/', (req, res) => { res.send('Hello World') }) server.listen(3000)
Statistics Avg Stdev Max Reqs/sec 63469.85 4151.42 71137.01 Latency 785.56us 72.93us 2.94ms HTTP codes: 1xx - 0, 2xx - 100000, 3xx - 0, 4xx - 0, 5xx - 0 others - 0 Throughput: 9.02MB/s
-
import Koa from 'koa' const app = new Koa() app.use(ctx => { ctx.body = 'Hello World' }) app.listen(3000)
Statistics Avg Stdev Max Reqs/sec 19481.55 7894.14 64516.00 Latency 2.56ms 2.34ms 202.35ms HTTP codes: 1xx - 0, 2xx - 92364, 3xx - 0, 4xx - 0, 5xx - 0 others - 7636 Errors: dial tcp 127.0.0.1:3000: connect: connection refused - 7636 Throughput: 4.07MB/s
-
import { createServer } from 'node:http' const server = createServer((req, res) => { res.writeHead(200, { 'content-type': 'text/plain' }) res.write('Hello World') res.end() }) server.listen(3000, '127.0.0.1')
Statistics Avg Stdev Max Reqs/sec 26740.56 8268.06 60127.09 Latency 1.87ms 1.75ms 150.79ms HTTP codes: 1xx - 0, 2xx - 96351, 3xx - 0, 4xx - 0, 5xx - 0 others - 3649 Errors: dial tcp 127.0.0.1:3000: connect: connection refused - 3649 Throughput: 5.90MB/s
-
import { App } from 'uWebSockets.js' const app = App() app.get('/', (res, req) => { res.end('Hello World') }) app.listen(3000, () => {})
Statistics Avg Stdev Max Reqs/sec 72510.39 3791.38 81226.59 Latency 686.07us 190.25us 9.90ms HTTP codes: 1xx - 0, 2xx - 96306, 3xx - 0, 4xx - 0, 5xx - 0 others - 3694 Errors: dial tcp 127.0.0.1:3000: connect: connection refused - 3694 Throughput: 11.05MB/s