-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
132 additions
and
0 deletions.
There are no files selected for viewing
File renamed without changes.
46 changes: 46 additions & 0 deletions
46
scripts/iterationRate/rampingArrivalRate/fastRampingArrivalRate.js
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,46 @@ | ||
import http from 'k6/http'; | ||
import { group, sleep } from 'k6'; | ||
|
||
const BASE_URL = `http://${__ENV.HOST || 'localhost'}:8080/tools.descartes.teastore.webui`; | ||
|
||
const groupResponseTimes = {}; | ||
|
||
export const options = { | ||
discardResponseBodies: true, | ||
scenarios: { | ||
fastRampingArrivalRate: { | ||
executor: 'ramping-arrival-rate', | ||
|
||
// Start `startRate` iterations per second | ||
timeUnit: '1s', | ||
|
||
// Pre-allocate necessary VUs. | ||
preAllocatedVUs: 100, | ||
|
||
stages: [ | ||
|
||
{ target: 20, duration: '10s' }, | ||
|
||
{ target: 50, duration: '10s' }, | ||
|
||
{ target: 100, duration: '30s' }, | ||
|
||
{ target: 200, duration: '60s' }, | ||
|
||
{ target: 50, duration: '30s' }, | ||
], | ||
}, | ||
}, | ||
}; | ||
|
||
export default function () { | ||
group('Black Tea Category Browse', () => { | ||
const start = new Date(); | ||
http.get(`${BASE_URL}/category?category=2&page=1`); | ||
const end = new Date(); | ||
const duration = end - start; | ||
groupResponseTimes['Black Tea Category Browse'] = (groupResponseTimes['Black Tea Category Browse'] || 0) + duration; | ||
// Sleep time is 1000ms. Total iteration time is sleep + time to finish request. | ||
sleep(1); | ||
}); | ||
} |
38 changes: 38 additions & 0 deletions
38
scripts/iterationRate/rampingArrivalRate/rampingExample.js
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,38 @@ | ||
import http from 'k6/http'; | ||
|
||
export const options = { | ||
discardResponseBodies: true, | ||
|
||
scenarios: { | ||
contacts: { | ||
executor: 'ramping-arrival-rate', | ||
|
||
// Start iterations per `timeUnit` | ||
startRate: 300, | ||
|
||
// Start `startRate` iterations per minute | ||
timeUnit: '1m', | ||
|
||
// Pre-allocate necessary VUs. | ||
preAllocatedVUs: 50, | ||
|
||
stages: [ | ||
// Start 300 iterations per `timeUnit` for the first minute. | ||
{ target: 300, duration: '1m' }, | ||
|
||
// Linearly ramp-up to starting 600 iterations per `timeUnit` over the following two minutes. | ||
{ target: 600, duration: '2m' }, | ||
|
||
// Continue starting 600 iterations per `timeUnit` for the following four minutes. | ||
{ target: 600, duration: '4m' }, | ||
|
||
// Linearly ramp-down to starting 60 iterations per `timeUnit` over the last two minutes. | ||
{ target: 60, duration: '2m' }, | ||
], | ||
}, | ||
}, | ||
}; | ||
|
||
export default function () { | ||
http.get('https://test.k6.io/contacts.php'); | ||
} |
48 changes: 48 additions & 0 deletions
48
scripts/iterationRate/rampingArrivalRate/slowerRampingArrivalRate.js
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,48 @@ | ||
import http from 'k6/http'; | ||
import { group, sleep } from 'k6'; | ||
|
||
const BASE_URL = `http://${__ENV.HOST || 'localhost'}:8080/tools.descartes.teastore.webui`; | ||
|
||
const groupResponseTimes = {}; | ||
|
||
export const options = { | ||
discardResponseBodies: true, | ||
scenarios: { | ||
fastRampingArrivalRate: { | ||
executor: 'ramping-arrival-rate', | ||
|
||
// Start `startRate` iterations per second | ||
timeUnit: '1m', | ||
|
||
// Pre-allocate necessary VUs. | ||
preAllocatedVUs: 100, | ||
|
||
stages: [ | ||
|
||
{ target: 20, duration: '1min' }, | ||
|
||
{ target: 50, duration: '1min' }, | ||
|
||
{ target: 100, duration: '1min' }, | ||
|
||
{ target: 200, duration: '2min' }, | ||
|
||
{ target: 50, duration: '2min' }, | ||
|
||
{ target: 50, duration: '30s' }, | ||
], | ||
}, | ||
}, | ||
}; | ||
|
||
export default function () { | ||
group('Black Tea Category Browse', () => { | ||
const start = new Date(); | ||
http.get(`${BASE_URL}/category?category=2&page=1`); | ||
const end = new Date(); | ||
const duration = end - start; | ||
groupResponseTimes['Black Tea Category Browse'] = (groupResponseTimes['Black Tea Category Browse'] || 0) + duration; | ||
// Sleep time is 1000ms. Total iteration time is sleep + time to finish request. | ||
sleep(1); | ||
}); | ||
} |