-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add storage load scripts to examples (#41)
- Loading branch information
1 parent
7f66c1b
commit 10a6475
Showing
35 changed files
with
1,288 additions
and
129 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
.PHONY: db_test | ||
|
||
MAKEFLAGS += -j2 | ||
|
||
export | ||
|
||
conns ?= 1 | ||
rampingduration ?= 5 | ||
consecutiveduration ?= 60 | ||
requests ?= 1 | ||
rand = $(shell bash -c 'echo $$RANDOM') | ||
testrun ?= "random-run-$(rand)" | ||
|
||
load: | ||
@RAMPING_DURATION=$(rampingduration) CONSECUTIVE_DURATION=$(consecutiveduration) \ | ||
REQUESTS=$(requests) CONNS=$(conns) TEST_RUN=$(testrun) ./k6 run load.js \ | ||
--tag testrun=$(testrun) --tag system='storage_api' -o 'prometheus=namespace=k6' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/** | ||
* Return a random integer between the minimum (inclusive) | ||
* and maximum (exclusive) values | ||
* @param {number} min - The minimum value to return. | ||
* @param {number} max - The maximum value you want to return. | ||
* @return {number} The random number between the min and max. | ||
*/ | ||
export function getRandomInt(min, max) { | ||
min = Math.ceil(min) | ||
max = Math.floor(max) | ||
// The maximum is exclusive and the minimum is inclusive | ||
return Math.floor(Math.random() * (max - min) + min) | ||
} | ||
|
||
/** | ||
* Generate default k6 ramping-vus scenario. | ||
* @param {number} baseDuration - Total duration of the scenario. | ||
* @param {number} conns - max number of vus during the scenario execution. | ||
* | ||
* It starts with 0 VUs, ramps up to half the number of connections in 1/12 of total duration then | ||
* it remains on this number for 1/4 of total duration time. | ||
* Then ramps down to a quarter of the number of connections in 1/12 of total duration. | ||
* Then ramps up to the full number of connections in 1/6 of total duration and | ||
* it remains on this number for 1/3 of total duration time. | ||
* Then ramps down to a quarter of the number of connections in 1/12 of total duration, | ||
* then ramps down to 0 VUs in 10s. | ||
*/ | ||
export function scenario(rampingDuration, consecutiveDuration, conns) { | ||
return { | ||
executor: 'ramping-vus', | ||
startVUs: 0, | ||
stages: [ | ||
{ | ||
duration: `${parseInt(rampingDuration)}s`, | ||
target: parseInt(conns), | ||
}, | ||
{ | ||
duration: `${parseInt(consecutiveDuration)}s`, | ||
target: parseInt(conns), | ||
}, | ||
{ | ||
duration: '30s', | ||
target: parseInt(conns), | ||
}, | ||
], | ||
gracefulRampDown: '10s', | ||
} | ||
} | ||
|
||
/* Exporting an array of default summaryTrendStats to be used in summary result. */ | ||
export const trends = ['avg', 'med', 'p(99)', 'p(95)', 'p(0.1)', 'count'] |
Oops, something went wrong.