node-server icon indicating copy to clipboard operation
node-server copied to clipboard

benchmark

Open OnurGvnc opened this issue 2 years ago • 4 comments

Hi, How do you compare performance with other node.js frameworks? Which tool or command do you use for benchmarking?

I did something like https://github.com/OnurGvnc/hono-node-server/tree/dev/benchmarks

{ connections: 50, duration: 10 }

fastify           105,594 req/seq
hono               50,012 req/seq
express            24,613 req/seq
hono (undici)      17,648 req/seq

with MacBookAir10,1 M1 16GB RAM 8 Core

OnurGvnc avatar Sep 14 '22 16:09 OnurGvnc

First, I've removed the example directory https://github.com/honojs/node-server/commit/6c0dade29b98c92d696e3315fd790506ad7a8b79. I think it's better to put the examples in other places such https://github.com/honojs/examples

About benchmarks. I recommend using Oha or bombardier than autocannon because they are faster than that.

I think we need to try several other methods instead of just benchmarking "Hello World". For example, parsing URL query and path parameters, rendering JSON or parsing request body. The following projects are for reference.

SaltyAom/bun-http-framework-benchmark: Compare throughput benchmark from various Bun HTTP framework

By the way, it is better to put the benchmark directory in this project.

yusukebe avatar Sep 15 '22 01:09 yusukebe

Hey there, so lately I've been benchmarking my Rust programs against equivalent node js programs. To do multiple benchmarks with multiple runs, I've been using https://github.com/sharkdp/hyperfine , It has everything for benchmarks and it is both beautiful and fast. I think it would be great if we use this in a script along with oha. It can also export to markdown and has a wide range of options for fine tuning the benchmarks.

that-ambuj avatar Nov 21 '22 07:11 that-ambuj

Hi @that-ambuj

It looks good! I've already stared that repository but, I did not try yet:)

yusukebe avatar Nov 21 '22 11:11 yusukebe

I'll try and make benchmark scripts when I have free time.

that-ambuj avatar Nov 22 '22 05:11 that-ambuj