Skip to content

Commit

Permalink
Merge pull request #49 from IABTechLab/tjm-UID2-4451-update-load-scripts
Browse files Browse the repository at this point in the history
Update load scripts
  • Loading branch information
thomasm-ttd authored Dec 19, 2024
2 parents 2a2e40b + 791de27 commit a51f20f
Show file tree
Hide file tree
Showing 9 changed files with 480 additions and 24 deletions.
3 changes: 3 additions & 0 deletions performance-testing/uid2-operator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ If you would like to test locally, follow these steps:
#### Option 2b - Execute K6 Script in K8s
In order to reduce network latency, we should deploy k6 and its script with the same zone of UID2 operator.
Follow the installation instructions here: https://grafana.com/blog/2022/06/23/running-distributed-load-tests-on-kubernetes
Set environment variables `CLIENT_KEY`, `CLIENT_SECRET`, `BASE_URL` and then use k6 to execute the testing by following command.
```
k6 run k6-uid2-operator.js -e CLIENT_KEY=$CLIENT_KEY -e CLIENT_SECRET=$CLIENT_SECRET -e BASE_URL=$BASE_URL -e REFRESH_TOKEN=$REFRESH_TOKEN
Expand Down
12 changes: 9 additions & 3 deletions performance-testing/uid2-operator/k6-test-resource.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,15 @@ kind: K6
metadata:
name: k6-uid2-load-test
spec:
parallelism: 4
arguments: --out cloud
parallelism: 3
arguments: --out experimental-prometheus-rw --tag "testid=replacecomment"
script:
configMap:
name: operator-stress-test
file: k6-uid2-operator-encrypt-inline.js
file: replaced
runner:
env:
- name: K6_PROMETHEUS_RW_SERVER_URL
value: "http://prometheus-server.prometheus/api/v1/write"
- name: K6_PROMETHEUS_RW_TREND_AS_NATIVE_HISTOGRAM
value: "true"
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@

import { crypto } from "k6/experimental/webcrypto";
import encoding from 'k6/encoding';
import { check } from 'k6';
import http from 'k6/http';

const generateVUs = 500;
const refreshVUs = 500;
const identityMapVUs = 500;
const vus = 500;
const baseUrl = "http://uid2-prod-opr-use2-alb-698161474.us-east-2.elb.amazonaws.com";
const clientSecret = "";
const clientKey = "";

const generateVUs = vus;
const refreshVUs = vus;
const identityMapVUs = vus;
const testDuration = '10m'

//30 warm up on each
Expand All @@ -18,7 +24,6 @@ export const options = {
noConnectionReuse: false,
scenarios: {
// Warmup scenarios

tokenGenerateWarmup: {
executor: 'ramping-vus',
exec: 'tokenGenerate',
Expand Down Expand Up @@ -67,7 +72,7 @@ export const options = {
duration: testDuration,
gracefulStop: '0s',
startTime: '30s',
},/*
}/*,
identityMapLargeBatchSequential: {
executor: 'constant-vus',
exec: 'identityMapLargeBatch',
Expand Down Expand Up @@ -114,11 +119,6 @@ for (let key in options.scenarios) {
options.thresholds[thresholdName].push('max>=0');
}

// Configs
const clientSecret = __ENV.CLIENT_SECRET;
const clientKey = __ENV.CLIENT_KEY;
const baseUrl = __ENV.BASE_URL;

export async function setup() {
var token = await generateRefreshRequest();
return {
Expand All @@ -137,7 +137,12 @@ export async function setup() {
let decrypt = await decryptEnvelope(response.body, clientSecret)
return decrypt.body.refresh_token;
};
}

export function handleSummary(data) {
return {
'summary.json': JSON.stringify(data),
}
}

// Scenarios
Expand Down
Loading

0 comments on commit a51f20f

Please sign in to comment.