···21212222Use the sample [`.env.example`](/.env.example) to create an `.env` for your scenario.
23232424-* `TARGET` = number of concurrent requests to make
2424+* `TARGET` = number of concurrent requests to make per second
2525* `DURATION` = number of seconds to run load
2626* `RANDOMIZE` = randomize url path
2727* `URL` = leave as default unless modifying this project for your own use
+12-8
script.ts
···19192020// Test configuration
2121export const options = {
2222- // Ramp the number of virtual users up and down
2323- stages: [
2424- { duration, target }
2525- ],
2222+ discardResponseBodies: true,
2323+ scenarios: {
2424+ constant: {
2525+ executor: 'constant-arrival-rate',
2626+ duration,
2727+ preAllocatedVUs: Math.max(2, target/2),
2828+ rate: target,
2929+ maxVUs: target,
3030+ timeUnit: '1s'
3131+ }
3232+ }
2633};
27342835const URL = __ENV.URL;
···3643 const path = Array.from({length: randomIntBetween(1,4)}, (_, i) => randomString(randomIntBetween(2,10))).join('/');
3744 u = `${u}/${path}`;
3845 }
3939- let res = http.get(u, {
4646+ http.get(u, {
4047 headers: {
4148 'User-Agent': generateRandomUserAgent()
4249 }
4350 });
4444- // Validate response status
4545- check(res, { "status was 200": (r) => r.status == 200 });
4646- sleep(1);
4751}