Skip to content

Commit

Permalink
Update scenarios
Browse files Browse the repository at this point in the history
  • Loading branch information
mikevespi committed Jan 3, 2025
1 parent dfcd14e commit e4a0991
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 37 deletions.
4 changes: 2 additions & 2 deletions performance_tests/backend_script.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ export const options = {
addAndRemoveComplaintOutcome: defaultOptions,
},
thresholds: {
http_req_duration: ["p(99)<2000"], // 99% of requests must complete below 2s
http_req_duration: ["p(99)<2000"], // ms that 99% of requests must be completed within
},
rps: __ENV.RPS, // If over 50, notify platform services first.
// rps: 50, // Do not increase to over 50 without informing Platform Services
};

/**
Expand Down
33 changes: 20 additions & 13 deletions performance_tests/common/params.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
const TEST_RUN_USERS = 1;
const MIN_USERS = 20;
const MAX_USERS = 250;
const MAX_USERS = 200;
const AVERAGE_USERS = 75;
const STRESS_LOAD_USERS = 150;

Expand All @@ -20,23 +20,30 @@ export const STAGES = {

// Smoke tests for minimum expected load
smoke: [
{ duration: "3m", target: MIN_USERS }, // ramp-up of traffic to the smoke users
{ duration: "10m", target: MIN_USERS }, // stay at minimum users for 10 minutes
{ duration: "2m", target: 0 }, // ramp-down to 0 users
{ duration: "1m", target: MIN_USERS }, // ramp-up of traffic to the smoke users
{ duration: "2m", target: MIN_USERS }, // stay at minimum users for 10 minutes
{ duration: "1m", target: 0 }, // ramp-down to 0 users
],

// Load tests for average load
// Load tests at average load
load: [
{ duration: "2m", target: MIN_USERS }, // ramp up to minimum users
{ duration: "5m", target: MIN_USERS }, // maintain minimum users
{ duration: "5m", target: AVERAGE_USERS }, // ramp up to average user base
{ duration: "30m", target: AVERAGE_USERS }, // maintain average user base
{ duration: "1m", target: AVERAGE_USERS }, // ramp up to average user base
{ duration: "10m", target: AVERAGE_USERS }, // maintain average user base
{ duration: "1m", target: 0 }, // ramp down
],

// Load tests for average load with a spike to stress load
load_with_spike: [
{ duration: "1m", target: MIN_USERS }, // ramp up to minimum users
{ duration: "2m", target: MIN_USERS }, // maintain minimum users
{ duration: "1m", target: AVERAGE_USERS }, // ramp up to average user base
{ duration: "10m", target: AVERAGE_USERS }, // maintain average user base
// Small spike
{ duration: "2m", target: STRESS_LOAD_USERS }, // scale up to stress load
{ duration: "1m", target: STRESS_LOAD_USERS }, // scale up to stress load
{ duration: "2m", target: STRESS_LOAD_USERS }, // briefly maintain stress load
{ duration: "2m", target: AVERAGE_USERS }, // scale back to average users
{ duration: "5m", target: AVERAGE_USERS }, // maintain average users
{ duration: "10m", target: 0 }, // gradually drop to 0 users
{ duration: "1m", target: AVERAGE_USERS }, // scale back to average users
{ duration: "2m", target: AVERAGE_USERS }, // briefly maintain average users
{ duration: "1m", target: 0 }, // maintain average users
],

// Stress tests for heavy load
Expand Down
43 changes: 21 additions & 22 deletions performance_tests/frontend_script.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,38 +4,37 @@ import { browserTest } from "./tests/frontend/browser.js";
import { protocolTest } from "./tests/frontend/protocol.js";
import { INITIAL_TOKEN, INITIAL_REFRESH_TOKEN, generateRequestConfig } from "./common/auth.js";

/**
* To run with an open browser, prepend the make command with K6_BROWSER_HEADLESS=false
*/
const defaultOptions = {
executor: "constant-vus",
// Due to the heavy nature of the front end tests experiment with the number of VUs
// and maybe try running one scenario at a time to avoid overloading your system and getting errors
vus: 1, // If running all 4 scenarios this is 1x4=4 VUs
duration: "10000s",
// Use activeBrowserOptions for the browser test if you aren't running it headless
const activeBrowserOptions = {
executor: "per-vu-iterations",
vus: 1,
options: {
browser: {
type: "chromium",
},
},
};

const defaultOptions = {
executor: "ramping-vus",
stages: STAGES[`${__ENV.LOAD}`],
};

/**
* To run with an open browser, prepend the make command with:
* K6_BROWSER_HEADLESS=false
* It is suggested to use the activeBrowserOptions when doing so as browsers will eat up a significant amount of local
* resources which may affect the results of the tests in a way that is not representative of the servers performance.
*/
export const options = {
scenarios: {
browserTest: {
executor: "per-vu-iterations",
options: {
browser: {
type: "chromium",
},
},
},
protocolTest: {
executor: "constant-vus",
vus: 1,
duration: "20s",
},
browserTest: activeBrowserOptions,
protocolTest: defaultOptions,
},
thresholds: {
http_req_duration: ["p(99)<2000"], // ms that 99% of requests must be completed within
},
// rps: 50, // Do not increase to over 50 without informing Platform Services
};

const TOKEN_REFRESH_TIME = 60;
Expand Down

0 comments on commit e4a0991

Please sign in to comment.