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/memory using psrecord, if it installed.
Usage#
Create .env#
Use the sample .env.example to create an .env for your scenario.
TARGET= number of concurrent requests to makeDURATION= 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 psrecord, if not present:
pipx install psrecord[plot]
Run bench.sh from the project directory, providing the duration the load will be run:
# DURATION=12 from .env then...
./bench.sh 12
After the run has finished an image plot_[unix_timestamp].png will be generated in the project directory.
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