-
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.
Update perf tests for constant benchmark load (#455)
* Update perf tests for constant benchmark load * Adds suite k6 script to run all scenarios, github action for adhoc runs * Use workflow input for perf test action and fix typo * Fix broken artifact path
- Loading branch information
Showing
9 changed files
with
240 additions
and
28 deletions.
There are no files selected for viewing
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,35 @@ | ||
name: k6 Performance benchmark tests | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
environment: | ||
type: environment | ||
description: "Choose an environment to run against" | ||
required: true | ||
|
||
jobs: | ||
run-k6-tests: | ||
runs-on: ubuntu-latest | ||
if: github.event.inputs.environment == 'development' || github.event.inputs.environment == 'test' | ||
defaults: | ||
run: | ||
working-directory: Dfe.Academies.Performance/scripts | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Run k6 test | ||
uses: grafana/k6-action@v0.3.1 | ||
with: | ||
filename: suite.js | ||
env: | ||
BASE_URL: ${{ secrets.TRAMS_API_BASE_URL }} | ||
API_KEY: ${{ secrets.TRAMS_API_KEY }} | ||
|
||
- name: Upload report | ||
if: ${{ success() }} | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: summary | ||
path: summary.html |
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 @@ | ||
summary.html |
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,107 @@ | ||
import { htmlReport } from 'https://raw.githubusercontent.com/benc-uk/k6-reporter/main/dist/bundle.js' | ||
import { textSummary } from 'https://jslib.k6.io/k6-summary/0.0.1/index.js' | ||
import { default as keyStagePerformance } from './v1/keyStagePerformance.js' | ||
import { default as baselineTracker } from './v2/baselineTracker.js' | ||
import { default as fssProjects } from './v2/fssProjects.js' | ||
import { default as trustsV3 } from './v3/trusts.js' | ||
import { default as establishments } from './v4/establishments.js' | ||
import { default as trustsV4 } from './v4/trusts.js' | ||
|
||
export const options = { | ||
thresholds: { | ||
http_req_failed: ['rate<0.01'], // Failure rate less than 1% | ||
http_req_duration: ['p(95)<1000'] // Requests take <1s at the 95th percentile | ||
}, | ||
scenarios: { | ||
keyStagePerformance: { | ||
exec: 'ksp', | ||
executor: 'constant-arrival-rate', | ||
duration: '10s', | ||
preAllocatedVUs: 100, | ||
rate: 10, | ||
timeUnit: '1s', | ||
gracefulStop: '60s' | ||
}, | ||
baselineTracker: { | ||
exec: 'bt', | ||
executor: 'constant-arrival-rate', | ||
duration: '10s', | ||
preAllocatedVUs: 100, | ||
rate: 10, | ||
timeUnit: '1s', | ||
gracefulStop: '60s', | ||
startTime: '30s' | ||
}, | ||
fssProjects: { | ||
exec: 'fss', | ||
executor: 'constant-arrival-rate', | ||
duration: '10s', | ||
preAllocatedVUs: 100, | ||
rate: 10, | ||
timeUnit: '1s', | ||
gracefulStop: '60s', | ||
startTime: '60s' | ||
}, | ||
trustsV3: { | ||
exec: 'v3t', | ||
executor: 'constant-arrival-rate', | ||
duration: '10s', | ||
preAllocatedVUs: 100, | ||
rate: 10, | ||
timeUnit: '1s', | ||
gracefulStop: '60s', | ||
startTime: '90s' | ||
}, | ||
establishments: { | ||
exec: 'est', | ||
executor: 'constant-arrival-rate', | ||
duration: '10s', | ||
preAllocatedVUs: 100, | ||
rate: 10, | ||
timeUnit: '1s', | ||
gracefulStop: '60s', | ||
startTime: '120s' | ||
}, | ||
trustsV4: { | ||
exec: 'v4t', | ||
executor: 'constant-arrival-rate', | ||
duration: '10s', | ||
preAllocatedVUs: 100, | ||
rate: 10, | ||
timeUnit: '1s', | ||
gracefulStop: '60s', | ||
startTime: '150s' | ||
}, | ||
} | ||
} | ||
|
||
export function ksp() { | ||
keyStagePerformance() | ||
} | ||
|
||
export function bt() { | ||
baselineTracker() | ||
} | ||
|
||
export function fss() { | ||
fssProjects() | ||
} | ||
|
||
export function v3t() { | ||
trustsV3() | ||
} | ||
|
||
export function v4t() { | ||
trustsV4() | ||
} | ||
|
||
export function est() { | ||
establishments() | ||
} | ||
|
||
export function handleSummary(data) { | ||
return { | ||
'summary.html': htmlReport(data), | ||
stdout: textSummary(data, { indent: ' ', enableColors: true }), | ||
} | ||
} |
18 changes: 15 additions & 3 deletions
18
Dfe.Academies.Performance/scripts/v1/keyStagePerformance.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
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
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