From 693f79c041ced68b33c143804033f4f903610b5d Mon Sep 17 00:00:00 2001 From: Matt Bishop Date: Mon, 3 Jul 2023 10:30:05 -0400 Subject: [PATCH] Add complexity to load tests via scenarios (#3034) --- perf/load/config.js | 34 +++++++++++++++++++++++++++------- perf/load/groups.js | 34 +++++++++++++++++++++++++++------- perf/load/login.js | 32 +++++++++++++++++++++++++------- 3 files changed, 79 insertions(+), 21 deletions(-) diff --git a/perf/load/config.js b/perf/load/config.js index 76a79b0919..16a7c7e64a 100644 --- a/perf/load/config.js +++ b/perf/load/config.js @@ -15,15 +15,35 @@ export const options = { name: "Config", }, }, - stages: [ - { duration: "30s", target: 10 }, - { duration: "1m", target: 20 }, - { duration: "2m", target: 25 }, - { duration: "30s", target: 0 }, - ], + scenarios: { + constant_load: { + executor: "constant-arrival-rate", + rate: 1, + timeUnit: "1s", // 1 request / second + duration: "10m", + preAllocatedVUs: 5, + }, + ramping_load: { + executor: "ramping-arrival-rate", + startRate: 60, + timeUnit: "1m", // 1 request / second to start + stages: [ + { duration: "30s", target: 60 }, + { duration: "2m", target: 150 }, + { duration: "1m", target: 90 }, + { duration: "2m", target: 200 }, + { duration: "2m", target: 120 }, + { duration: "1m", target: 180 }, + { duration: "30s", target: 250 }, + { duration: "30s", target: 90 }, + { duration: "30s", target: 0 }, + ], + preAllocatedVUs: 40, + }, + }, thresholds: { http_req_failed: ["rate<0.01"], - http_req_duration: ["p(95)<1000"], + http_req_duration: ["p(95)<750"], }, }; diff --git a/perf/load/groups.js b/perf/load/groups.js index 1ea4b5b0d8..d24f55e3e8 100644 --- a/perf/load/groups.js +++ b/perf/load/groups.js @@ -16,15 +16,35 @@ export const options = { name: "Groups", }, }, - stages: [ - { duration: "30s", target: 10 }, - { duration: "1m", target: 20 }, - { duration: "2m", target: 25 }, - { duration: "30s", target: 0 }, - ], + scenarios: { + constant_load: { + executor: "constant-arrival-rate", + rate: 30, + timeUnit: "1m", // 0.5 requests / second + duration: "10m", + preAllocatedVUs: 5, + }, + ramping_load: { + executor: "ramping-arrival-rate", + startRate: 30, + timeUnit: "1m", // 0.5 requests / second to start + stages: [ + { duration: "30s", target: 30 }, + { duration: "2m", target: 75 }, + { duration: "1m", target: 60 }, + { duration: "2m", target: 100 }, + { duration: "2m", target: 90 }, + { duration: "1m", target: 120 }, + { duration: "30s", target: 150 }, + { duration: "30s", target: 60 }, + { duration: "30s", target: 0 }, + ], + preAllocatedVUs: 20, + }, + }, thresholds: { http_req_failed: ["rate<0.01"], - http_req_duration: ["p(95)<1500"], + http_req_duration: ["p(95)<900"], }, }; diff --git a/perf/load/login.js b/perf/load/login.js index e95be6f513..d5ead94f56 100644 --- a/perf/load/login.js +++ b/perf/load/login.js @@ -12,15 +12,33 @@ export const options = { name: "Login", }, }, - stages: [ - { duration: "30s", target: 10 }, - { duration: "1m", target: 20 }, - { duration: "2m", target: 25 }, - { duration: "30s", target: 0 }, - ], + scenarios: { + constant_load: { + executor: "constant-arrival-rate", + rate: 2, + timeUnit: "1s", // 2 requests / second + duration: "10m", + preAllocatedVUs: 10, + }, + ramping_load: { + executor: "ramping-arrival-rate", + startRate: 60, + timeUnit: "1m", // 1 request / second to start + stages: [ + { duration: "30s", target: 60 }, + { duration: "5m", target: 120 }, + { duration: "2m", target: 150 }, + { duration: "1m", target: 180 }, + { duration: "30s", target: 200 }, + { duration: "30s", target: 90 }, + { duration: "30s", target: 0 }, + ], + preAllocatedVUs: 25, + }, + }, thresholds: { http_req_failed: ["rate<0.01"], - http_req_duration: ["p(95)<3000"], + http_req_duration: ["p(95)<1500"], }, };