This repository contains a Dockerized environment for benchmarking Fastify and Express.js web frameworks. The focus is on comparing throughput and database operations.
Fastify and Express are both popular frameworks for building web applications in Node.js, but they have different performance characteristics. This Dockerized setup aims to provide a controlled environment to benchmark these frameworks based on throughput and database I/O.
- Build the Docker image.
docker build -t benchmark-fastify-express .- Run the Docker container.
docker run -p 3000:3000 -p 3001:3001 benchmark-fastify-expressThe Docker image uses a multi-stage build to prepare the Node.js applications and then packages them into an Ubuntu image with Apache Bench installed. The Fastify and Express apps are started concurrently, and then the benchmark is executed. The results of the benchmark are saved to a benchmark_results.txt file, which is mapped to a results directory in your host system.
docker build -t benchmark-fastify-express .docker run -p 3000:3000 -p 3001:3001 -v $(pwd)/results:/results benchmark-fastify-expressAfter running the above command, you'll find the benchmark results in the results directory in your current working directory.
The following metrics are captured during the benchmarks:
- Throughput (Requests per Second)
- Latency (Average, P99)
- Error Rate
- Memory Usage
- CPU Utilization
