Skip to content

Instantly share code, notes, and snippets.

@diegopacheco
Last active July 28, 2023 19:33
Show Gist options
  • Save diegopacheco/fcd1389a92540f0fca3d3cc996205d3a to your computer and use it in GitHub Desktop.
Save diegopacheco/fcd1389a92540f0fca3d3cc996205d3a to your computer and use it in GitHub Desktop.
Actix(Rust) VS Netty(Java) VS Fastify(Nodejs)

Fastify did 6K RPS (Request per Second)
Netty did 23K RPS (Request Per Second)
Actix did 53K RPS (Request Per Second)

Actix 1ms latency
Netty 4ms latency
Fastify 14ms latency

npm install -g autocannon

Actix

git clone https://github.com/diegopacheco/rust-playground.git
cd rust-microservice/
cargo build --release
./target/release/news-service
autocannon -c 100 -d 40 -p 10 172.17.0.2:8080/

Image of Actix

Netty

docker run diegopacheco/time-microservice
autocannon -c 100 -d 40 -p 10 172.17.0.2:8080/rest/datetime

Image of Netty

Fastify

git clone https://github.com/diegopacheco/Diego-Pacheco-Sandbox.git
cd scripts/node.js/fastify-fun2/
npm install
npm start
autocannon -c 100 -d 40 -p 10 localhost:3000

Image of Fastify

@ManUtopiK
Copy link

ManUtopiK commented Feb 9, 2022

Fastify can certainly do better. 56254 req/sec with their benchmarks : https://www.fastify.io/benchmarks/

@steffenstolze
Copy link

steffenstolze commented Mar 8, 2023

I don't know what you've been testing on your side. On my local machine (Apple M1 Pro) I did the following benchmarks:

Rust webserver (190k RPS):

image

Running the Rust implementation with .workers(10) (same as # of workers in Node) did not improve the RPS.

Is there anything else you could do to improve the RPS that I missed?


Single thread Fastify Webserver with Node v16.17 (146k RPS):

image


Fastify Webserver in Cluster Mode with Node v18.13 (191k RPS):

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment