From 8b8f609512d77d551ab1a9e3b5e57be98f071d05 Mon Sep 17 00:00:00 2001 From: Dagfinn Olsen Date: Fri, 14 Feb 2025 12:53:48 +0100 Subject: [PATCH] chore(performance):tweaking of thresholds and improvements on performance smoketest (#1879) ## Description Tweaked som thresholds for search, up 500ms for get dialogs and get dialog for both endusers and serviceowners. Increased test duration from 30s to 60s to hopefully run more requests on a warmed-up system Set up parallelism in performance job matrix, we are not using standard github-runners anymore ## Related Issue(s) - #1862 ## Verification - [x] **Your** code builds clean without any errors or warnings - [x] Manual testing done (required) - [ ] Relevant automated test added (if you find this hard, leave it and we'll help out) ## Documentation - [ ] Documentation is updated (either in `docs`-directory, Altinnpedia or a separate linked PR in [altinn-studio-docs.](https://github.com/Altinn/altinn-studio-docs), if applicable) --- .github/workflows/ci-cd-yt01.yml | 5 +- .../workflows/workflow-run-k6-ci-cd-yt01.yml | 55 ------------------- .../enduserSearchWithThresholds.js | 4 +- .../serviceOwnerSearchWithThresholds.js | 5 +- .../performance/serviceowner-search.js | 9 +-- 5 files changed, 10 insertions(+), 68 deletions(-) delete mode 100644 .github/workflows/workflow-run-k6-ci-cd-yt01.yml diff --git a/.github/workflows/ci-cd-yt01.yml b/.github/workflows/ci-cd-yt01.yml index 2bd6472e8..84f57bb21 100644 --- a/.github/workflows/ci-cd-yt01.yml +++ b/.github/workflows/ci-cd-yt01.yml @@ -120,18 +120,19 @@ jobs: AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }} AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }} strategy: - max-parallel: 1 + max-parallel: 4 matrix: files: - tests/k6/tests/serviceowner/performance/serviceOwnerSearchWithThresholds.js - tests/k6/tests/serviceowner/performance/createDialogWithThresholds.js + - tests/k6/tests/serviceowner/performance/createTransmissionsWithThresholds.js - tests/k6/tests/enduser/performance/enduserSearchWithThresholds.js fail-fast: false with: environment: yt01 apiVersion: v1 vus: 1 - duration: 30s + duration: 60s testSuitePath: ${{ matrix.files }} parallelism: 1 breakpoint: false diff --git a/.github/workflows/workflow-run-k6-ci-cd-yt01.yml b/.github/workflows/workflow-run-k6-ci-cd-yt01.yml deleted file mode 100644 index 722c123f7..000000000 --- a/.github/workflows/workflow-run-k6-ci-cd-yt01.yml +++ /dev/null @@ -1,55 +0,0 @@ -name: Run K6 performance tests ci/cd yt01 - -on: - workflow_call: - inputs: - apiVersion: - required: true - type: string - environment: - required: true - type: string - testSuitePath: - required: true - type: string - vus: - required: true - type: number - duration: - required: true - type: string - ref: - description: "The branch or tag ref to run the tests on. Using default checkout ref if not provided." - required: false - default: ${{ github.ref }} - type: string - secrets: - TOKEN_GENERATOR_USERNAME: - required: true - TOKEN_GENERATOR_PASSWORD: - required: true -jobs: - k6-test: - runs-on: ubuntu-latest - environment: ${{ inputs.environment }} - permissions: - checks: write - pull-requests: write - steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - ref: ${{ inputs.ref }} - - name: Setup k6 - uses: grafana/setup-k6-action@v1 - - name: Run K6 tests (${{ inputs.testSuitePath }}) - run: | - echo "Running k6 test suite ${{ inputs.testSuitePath }} with ${{ inputs.vus }} VUs for ${{ inputs.duration }}" - k6 run ${{ inputs.testSuitePath }} --quiet --log-output=stdout --include-system-env-vars \ - --vus=${{ inputs.vus }} --duration=${{ inputs.duration }} --out csv=./results.csv - grep http_req_duration ./results.csv | sort --field-separator=',' --key=3 -nr | head -10 - env: - API_ENVIRONMENT: ${{ inputs.environment }} - API_VERSION: ${{ inputs.apiVersion }} - TOKEN_GENERATOR_USERNAME: ${{ secrets.TOKEN_GENERATOR_USERNAME }} - TOKEN_GENERATOR_PASSWORD: ${{ secrets.TOKEN_GENERATOR_PASSWORD }} \ No newline at end of file diff --git a/tests/k6/tests/enduser/performance/enduserSearchWithThresholds.js b/tests/k6/tests/enduser/performance/enduserSearchWithThresholds.js index bf03ab17b..a43989c35 100644 --- a/tests/k6/tests/enduser/performance/enduserSearchWithThresholds.js +++ b/tests/k6/tests/enduser/performance/enduserSearchWithThresholds.js @@ -7,8 +7,8 @@ export let options = { duration: "30s", thresholds: { ..._options.thresholds, - "http_req_duration{name:enduser search}": ["p(95)<300"], - "http_req_duration{name:get dialog}": ["p(95)<300"], + "http_req_duration{name:enduser search}": ["p(95)<500"], + "http_req_duration{name:get dialog}": ["p(95)<500"], "http_req_duration{name:get dialog activities}": ["p(95)<300"], "http_req_duration{name:get dialog activity}": ["p(95)<300"], "http_req_duration{name:get seenlogs}": ["p(95)<300"], diff --git a/tests/k6/tests/serviceowner/performance/serviceOwnerSearchWithThresholds.js b/tests/k6/tests/serviceowner/performance/serviceOwnerSearchWithThresholds.js index bf6f9ce8b..9db6c1186 100644 --- a/tests/k6/tests/serviceowner/performance/serviceOwnerSearchWithThresholds.js +++ b/tests/k6/tests/serviceowner/performance/serviceOwnerSearchWithThresholds.js @@ -1,5 +1,4 @@ import { default as run, options as _options } from "./serviceowner-search.js"; -export { setup as setup } from '../../performancetest_common/readTestdata.js'; export let options = { summaryTrendStats: ['avg', 'min', 'med', 'max', 'p(95)', 'p(99)', 'p(99.5)', 'p(99.9)', 'count'], @@ -7,8 +6,8 @@ export let options = { duration: "30s", thresholds: { ..._options.thresholds, - "http_req_duration{name:serviceowner search}": ["p(95)<300"], - "http_req_duration{name:get dialog}": ["p(95)<300"], + "http_req_duration{name:serviceowner search}": ["p(95)<500"], + "http_req_duration{name:get dialog}": ["p(95)<500"], "http_req_duration{name:get dialog activities}": ["p(95)<300"], "http_req_duration{name:get dialog activity}": ["p(95)<300"], "http_req_duration{name:get seenlogs}": ["p(95)<300"], diff --git a/tests/k6/tests/serviceowner/performance/serviceowner-search.js b/tests/k6/tests/serviceowner/performance/serviceowner-search.js index 4fd78489d..4517d4efd 100644 --- a/tests/k6/tests/serviceowner/performance/serviceowner-search.js +++ b/tests/k6/tests/serviceowner/performance/serviceowner-search.js @@ -1,8 +1,6 @@ import { serviceownerSearch, emptySearchThresholds } from '../../performancetest_common/simpleSearch.js' -import { serviceOwners } from '../../performancetest_common/readTestdata.js'; -import { validateTestData } from '../../performancetest_common/readTestdata.js'; -export { setup as setup } from '../../performancetest_common/readTestdata.js'; - +import { serviceOwners, endUsers } from '../../performancetest_common/readTestdata.js'; +import { randomItem } from '../../../common/k6-utils.js'; const tag_name = 'serviceowner search'; const traceCalls = (__ENV.traceCalls ?? 'false') === 'true'; @@ -17,7 +15,6 @@ export let options = { export default function(data) { - const { endUsers, index } = validateTestData(data, serviceOwners); - serviceownerSearch(serviceOwners[0], endUsers[index], tag_name, traceCalls); + serviceownerSearch(serviceOwners[0], randomItem(endUsers), tag_name, traceCalls); }