Skip to content

Commit a51f20f

Browse files
authored
Merge pull request #49 from IABTechLab/tjm-UID2-4451-update-load-scripts
Update load scripts
2 parents 2a2e40b + 791de27 commit a51f20f

File tree

9 files changed

+480
-24
lines changed

9 files changed

+480
-24
lines changed

performance-testing/uid2-operator/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ If you would like to test locally, follow these steps:
3030
#### Option 2b - Execute K6 Script in K8s
3131
In order to reduce network latency, we should deploy k6 and its script with the same zone of UID2 operator.
3232
33+
Follow the installation instructions here: https://grafana.com/blog/2022/06/23/running-distributed-load-tests-on-kubernetes
34+
35+
3336
Set environment variables `CLIENT_KEY`, `CLIENT_SECRET`, `BASE_URL` and then use k6 to execute the testing by following command.
3437
```
3538
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

performance-testing/uid2-operator/k6-test-resource.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,15 @@ kind: K6
33
metadata:
44
name: k6-uid2-load-test
55
spec:
6-
parallelism: 4
7-
arguments: --out cloud
6+
parallelism: 3
7+
arguments: --out experimental-prometheus-rw --tag "testid=replacecomment"
88
script:
99
configMap:
1010
name: operator-stress-test
11-
file: k6-uid2-operator-encrypt-inline.js
11+
file: replaced
12+
runner:
13+
env:
14+
- name: K6_PROMETHEUS_RW_SERVER_URL
15+
value: "http://prometheus-server.prometheus/api/v1/write"
16+
- name: K6_PROMETHEUS_RW_TREND_AS_NATIVE_HISTOGRAM
17+
value: "true"

performance-testing/uid2-operator/k6-uid2-operator-encrypt-inline.js renamed to performance-testing/uid2-operator/k6-token-generate-refresh-identitymap.js

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
1+
12
import { crypto } from "k6/experimental/webcrypto";
23
import encoding from 'k6/encoding';
34
import { check } from 'k6';
45
import http from 'k6/http';
56

6-
const generateVUs = 500;
7-
const refreshVUs = 500;
8-
const identityMapVUs = 500;
7+
const vus = 500;
8+
const baseUrl = "http://uid2-prod-opr-use2-alb-698161474.us-east-2.elb.amazonaws.com";
9+
const clientSecret = "";
10+
const clientKey = "";
11+
12+
const generateVUs = vus;
13+
const refreshVUs = vus;
14+
const identityMapVUs = vus;
915
const testDuration = '10m'
1016

1117
//30 warm up on each
@@ -18,7 +24,6 @@ export const options = {
1824
noConnectionReuse: false,
1925
scenarios: {
2026
// Warmup scenarios
21-
2227
tokenGenerateWarmup: {
2328
executor: 'ramping-vus',
2429
exec: 'tokenGenerate',
@@ -67,7 +72,7 @@ export const options = {
6772
duration: testDuration,
6873
gracefulStop: '0s',
6974
startTime: '30s',
70-
},/*
75+
}/*,
7176
identityMapLargeBatchSequential: {
7277
executor: 'constant-vus',
7378
exec: 'identityMapLargeBatch',
@@ -114,11 +119,6 @@ for (let key in options.scenarios) {
114119
options.thresholds[thresholdName].push('max>=0');
115120
}
116121

117-
// Configs
118-
const clientSecret = __ENV.CLIENT_SECRET;
119-
const clientKey = __ENV.CLIENT_KEY;
120-
const baseUrl = __ENV.BASE_URL;
121-
122122
export async function setup() {
123123
var token = await generateRefreshRequest();
124124
return {
@@ -137,7 +137,12 @@ export async function setup() {
137137
let decrypt = await decryptEnvelope(response.body, clientSecret)
138138
return decrypt.body.refresh_token;
139139
};
140+
}
140141

142+
export function handleSummary(data) {
143+
return {
144+
'summary.json': JSON.stringify(data),
145+
}
141146
}
142147

143148
// Scenarios

0 commit comments

Comments
 (0)