Crowdsec Benchmark#
This docker stack can be used to benchmark an out-of-the-box crowdsec installation. It contains:
- Traefik reverse proxy
- Configured with Access Logs that Crowdsec can consume
- Wired to serve mendhak/http-https-echo, a simple web server that accepts any paths and echos back the request as JSON
- Crowdsec
- Configured to consume Traefik logs
- With Collections required for parsing those logs and basic web traffic
- k6 load testing tool
- Configured to generate concurrent requests and duration of load using ENVs
- Randomized path (
RANDOMIZE=true) - Randomized User-Agent
Additionally, the bash script bench.sh can be used to orchestrate the load call, monitor the crowdsec process, and create a .png plot of CPU using goeffel, if it installed.
Usage#
Create .env#
Use the sample .env.example to create an .env for your scenario.
TARGET= number of concurrent requests to make per secondDURATION= number of seconds to run loadRANDOMIZE= randomize url pathURL= leave as default unless modifying this project for your own use
Run Load#
Using bench.sh#
Install latest development goeffel version:
pipx install git+https://github.com/jgehrcke/goeffel
Run bench.sh from the project directory. It requires sudo to collect metrics.
sudo ./bench.sh
After the run has finished an image [date]_crowdsec-web-traffic-load-[unix_timestamp].png will be generated in the project directory.
Additional graphs can be plotted from the generated hdf5 file using goeffel-analysis.
Manually#
- Start docker services required to run the load
docker compose up traefik echo crowdsec -d
-
Start any monitoring/profiling software for crowdsec
-
Run load
docker compose up k6
Benchmark Results#
See the bench-results folder for some benchmarks run on my own hardware.