[READ-ONLY] Mirror of https://github.com/FoxxMD/crowdsecBench. Benchmark Crowdsec CPU usage with concurrent requests
benchmark cpu-usage crowdsec docker k6 monitoring visualization
0

Configure Feed

Select the types of activity you want to include in your feed.

Update k6 to use constant arrival executor

Makes requests/s more consistent

FoxxMD (Sep 22, 2025, 3:01 PM EDT) ebd694a1 6f90f243

+13 -9
+1 -1
README.md
··· 21 21 22 22 Use the sample [`.env.example`](/.env.example) to create an `.env` for your scenario. 23 23 24 - * `TARGET` = number of concurrent requests to make 24 + * `TARGET` = number of concurrent requests to make per second 25 25 * `DURATION` = number of seconds to run load 26 26 * `RANDOMIZE` = randomize url path 27 27 * `URL` = leave as default unless modifying this project for your own use
+12 -8
script.ts
··· 19 19 20 20 // Test configuration 21 21 export const options = { 22 - // Ramp the number of virtual users up and down 23 - stages: [ 24 - { duration, target } 25 - ], 22 + discardResponseBodies: true, 23 + scenarios: { 24 + constant: { 25 + executor: 'constant-arrival-rate', 26 + duration, 27 + preAllocatedVUs: Math.max(2, target/2), 28 + rate: target, 29 + maxVUs: target, 30 + timeUnit: '1s' 31 + } 32 + } 26 33 }; 27 34 28 35 const URL = __ENV.URL; ··· 36 43 const path = Array.from({length: randomIntBetween(1,4)}, (_, i) => randomString(randomIntBetween(2,10))).join('/'); 37 44 u = `${u}/${path}`; 38 45 } 39 - let res = http.get(u, { 46 + http.get(u, { 40 47 headers: { 41 48 'User-Agent': generateRandomUserAgent() 42 49 } 43 50 }); 44 - // Validate response status 45 - check(res, { "status was 200": (r) => r.status == 200 }); 46 - sleep(1); 47 51 }