Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/marco-rosner/node-express-server
A server benchmark among pure NodeJS, ExpressJS, and Fiber (golang) using MongoDB
https://github.com/marco-rosner/node-express-server
benchmark docker docker-compose expressjs fiber golang javascript mongodb mongoose nodejs
Last synced: 11 days ago
JSON representation
A server benchmark among pure NodeJS, ExpressJS, and Fiber (golang) using MongoDB
- Host: GitHub
- URL: https://github.com/marco-rosner/node-express-server
- Owner: marco-rosner
- License: mit
- Created: 2023-09-29T19:48:44.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-05-29T02:02:37.000Z (6 months ago)
- Last Synced: 2024-05-29T15:47:50.648Z (6 months ago)
- Topics: benchmark, docker, docker-compose, expressjs, fiber, golang, javascript, mongodb, mongoose, nodejs
- Language: JavaScript
- Homepage:
- Size: 17.8 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
# NodeJS / ExpressJS server
After the benchmark of Go Servers (see [code here](https://github.com/marco-rosner/lightweight-go-server) and the [conclusions here](https://medium.com/p/caadd9a78319)), 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](https://github.com/zanfranceschi/rinha-de-backend-2023-q3) to get the results.
## Project Setup
```sh
npm install
```### Hot-Reload for Development
```sh
npm run dev:
```### Run server
```sh
npm run start:
```### Using Docker
Run `mongo:latest` image:
```sh
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:
```sh
docker build -t -server -f .dockerfile .
docker run --network="host" --rm -p 8080:8080 node-server
```### Using Docker Compose
Make sure that you have [docker](https://docs.docker.com/get-docker/) and [docker compose](https://docs.docker.com/compose/install/) installed. Next, you should choose which server (node or express) you would like to run (e.g. `docker-compose--mongo.yml`) and run the command like this:
```sh
docker-compose -f docker-compose--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
sh deps/gatling/bin/gatling.sh
```## Last results
![ExpressJS](./benchmark/resources/express-mongo.png?raw=true "ExpressJS server")
ExpressJS
![Fiber](./benchmark/resources/fiber-go-mongo.png?raw=true "Fiber server")
Fiber
![NodeJS](./benchmark/resources/node-server-mongo.png?raw=true "NodeJS server")
NodeJS