Select the types of activity you want to include in your feed.
refactor: Remove env requirement
* default url in script so not env is necessary * make env_file optional in compose * Use defaults in script, or load env, for logging and generating goeffel graph subtitle
···16161717Additionally, the bash script [`bench.sh`](/bench.sh) can be used to orchestrate the load call, monitor the crowdsec process, and create a .png plot of CPU using [`goeffel`](https://github.com/jgehrcke/goeffel).
18181919-# Usage
2020-2121-## Create .env
1919+## Usage
22202323-Use the sample [`.env.example`](/.env.example) to create an `.env` for your scenario.
2424-2525-* `TARGET` = number of concurrent requests to make per second
2626-* `DURATION` = number of seconds to run load
2727-* `RANDOMIZE` = randomize url path
2828-* `URL` = leave as default unless modifying this project for your own use
2121+### Run Load
29223030-## Run Load
3131-3232-### Using `bench.sh`
2323+#### Using `bench.sh`
33243425```shell
3526./bench.sh
···39304031Additional graphs can be plotted from the generated `hdf5` file using [`goeffel-analysis`](https://github.com/jgehrcke/goeffel?tab=readme-ov-file#goeffel-analysis-data-inspection-and-visualization).
41324242-### Manually
3333+#### Manually
433444351. Start docker services required to run the load
4536···6152docker compose up k6
6253```
63546464-# Benchmark Results
5555+### (Optional) Customize Load with .env
5656+5757+Use the sample [`.env.example`](/.env.example) to create an `.env` for your scenario.
5858+5959+* `TARGET` = number of concurrent requests to make per second
6060+* `DURATION` = number of seconds to run load (the `s` at the end is important)
6161+* `RANDOMIZE` = randomize url path -- `true` or `false`
6262+6363+## Benchmark Results
65646665See the [`bench-results`](/bench-results/) folder for some benchmarks run on my own hardware.
+12-2
bench.sh
···2233trap 'exit 0;' SIGHUP SIGINT
4455+TARGET='50'
66+DURATION='30s'
77+88+if test -f ".env"; then
99+ printf 'Found .env\n'
1010+ export $(cat .env | xargs)
1111+fi
1212+1313+printf 'RUN => %s concurrent requests over %s\n' "$TARGET" "$DURATION"
1414+515printf 'Starting traefik and echo...\n'
616docker compose up traefik echo -d
717···2131printf 'Starting goeffel capture of crowdsec PID %s \n' "$CS_PID"
2232docker compose run --rm --no-TTY goeffel goeffel --pid $CS_PID &
23332424-printf 'Starting k6\n'
3434+printf 'Starting k6, will run for %s\n' "$DURATION"
2535docker compose up k6 -d
26362737docker compose wait k6
···4454--column proc_cpu_util_percent_total \
4555'CPU util (total) / %' \
4656"Crowdsec Web Traffic Load $timestamp" 5 \
4747---subtitle '50 concurrent requests, measured with Goeffel' \
5757+--subtitle "$TARGET concurrent requests, measured with Goeffel" \
4858--legend-loc 'upper right' \
4959--mean-style solid \
5060--custom-y-limit 0 100