Skip to content

A server benchmark among pure NodeJS, ExpressJS, and Fiber (golang) using MongoDB

License

Notifications You must be signed in to change notification settings

marco-rosner/node-express-server

Repository files navigation

License: MIT

NodeJS / ExpressJS server

After the benchmark of Go Servers (see code here and the conclusions here), this project is a server benckmark among pure NodeJS, ExpressJS and Fiber (golang) server using MongoDB, Fiber and MongoDB are the winners from Go Servers benchmark. We will use some of the rules from Rinha de beckend to get the results.

Project Setup

npm install

Hot-Reload for Development

npm run dev:<node|express>

Run server

npm run start:<node|express>

Using Docker

Run mongo:latest image:

docker run -d -p 27017:27017 -p 28017:28017 -e AUTH=no mongo:latest

Build the node or express server image using the correspondent dockerfile then run the image:

docker build -t <node|express>-server -f <node|express>.dockerfile .
docker run --network="host" --rm -p 8080:8080 node-server

Using Docker Compose

Make sure that you have docker and docker compose installed. Next, you should choose which server (node or express) you would like to run (e.g. docker-compose-<server>-mongo.yml) and run the command like this:

docker-compose -f docker-compose-<node|express>-mongo.yml up --remove-orphans

Run benchmark

I am using Gatling to run the benchmark and to install it go to benchmark folder and run the install-gatling script. After that, move the BenchmarkSimulation.scala file to deps/gatling/user-files/simulations and the resources pessoas-payloads.tsv and termos-busca.tsv to deps/gatling/user-files/recources.

Go to the command line and run:

sh deps/gatling/bin/gatling.sh

Last results

ExpressJS ExpressJS
Fiber Fiber
NodeJS NodeJS