- Go to simulation folder
- For latency, run in terminal:
This benchmark runs for a non-specified amount of time (until the benchmark is stable). To run for a specific amount of time, run in terminal:
go test -bench=. -benchmemgo test -bench=. -benchmem -benchtime=100x - For throughput, run in terminal:
The simulation will run for 5 seconds and output the results.
go test -bench=. -benchmem -benchtime=5s - To run a complete benchmark:
This will run the benchmark for 5 seconds, using 8 CPUs, with no timeout and memory allocation statistics, it will also output the results to a file called outputFile.txt.
go test -bench=. -benchtime=5s -cpu=8 -timeout=0 -benchmem > outputFile.txt
- Locate to the root of the project
- Build and run the docker image
docker build -t simulation-benchmark-image .
docker run -it --rm -v ./results:/app/results simulation-benchmark-image bash # This opens up Bash terminal connected to docker instance
go test -bench=. -benchtime=5s -cpu=8 -timeout=0 -benchmem > /app/results/outputFile.txtThen, the output file will be generated at /results/outputFile.txt
Plan - build docker compose file to run the simulation and output the results to a file.