SlideShare a Scribd company logo
1 of 130
Download to read offline
DISTRIBUTED
By Thijs Feryn
LOAD TESTING
WITH K6
HI, I'M THIJS
I'M THE TECH
EVANGELIST
AT
10,000,000 WEBSITES
21% OF THE TOP 10K WEBSITES
I'M @THIJSFERYN
USER SERVER
USER VARNISH SERVER
MEASURE
HOW MUCH
IT CAN
HANDLE
BY
WRITE PERFORMANCE
TESTS IN
import http from 'k6/http';
import { sleep } from 'k6';
export default function () {
http.get('https://test.k6.io');
sleep(1);
}
RUN PERFORMANCE TESTS
✓LOCALLY OPEN SOURCE
✓IN THE CLOUD COMMERCIAL PRODUCT
✓VIA KUBERNETES OPEN SOURCE
$ k6 run script.js
$ k6 cloud script.js
---
apiVersion: k6.io/v1alpha1
kind: K6
metadata:
name: k6-sample
spec:
parallelism: 4
script:
configMap:
name: k6-test
file: test.js
$ kubectl apply -f k6.yaml
$ k6 run script.js
FOCUS ON
LOCAL
EXECUTOR
/ |‾‾| /‾‾/ /‾‾/
/ /  | |/ / / /
/ /  | ( / ‾‾
/  | |  | (‾) |
/ __________  |__| __ _____/ .io
execution: local
script: script.js
output: -
scenarios: (100.00%) 1 scenario, 1 max VUs, 10m30s max duration (incl. graceful stop):
* default: 1 iterations for each of 1 VUs (maxDuration: 10m0s, gracefulStop: 30s)
running (00m01.3s), 0/1 VUs, 1 complete and 0 interrupted iterations
default ✓ [========================] 1 VUs 00m01.3s/10m0s 1/1 iters, 1 per VU
data_received..................: 17 kB 13 kB/s
data_sent......................: 438 B 334 B/s
http_req_blocked...............: avg=204.96ms min=204.96ms med=204.96ms max=204.96ms p(90)=204.96ms p(95)=204.96ms
http_req_connecting............: avg=97.58ms min=97.58ms med=97.58ms max=97.58ms p(90)=97.58ms p(95)=97.58ms
http_req_duration..............: avg=105.05ms min=105.05ms med=105.05ms max=105.05ms p(90)=105.05ms p(95)=105.05ms
{ expected_response:true }...: avg=105.05ms min=105.05ms med=105.05ms max=105.05ms p(90)=105.05ms p(95)=105.05ms
http_req_failed................: 0.00% ✓ 0 ✗ 1
http_req_receiving.............: avg=143µs min=143µs med=143µs max=143µs p(90)=143µs p(95)=143µs
http_req_sending...............: avg=39µs min=39µs med=39µs max=39µs p(90)=39µs p(95)=39µs
http_req_tls_handshaking.......: avg=106.12ms min=106.12ms med=106.12ms max=106.12ms p(90)=106.12ms p(95)=106.12ms
http_req_waiting...............: avg=104.87ms min=104.87ms med=104.87ms max=104.87ms p(90)=104.87ms p(95)=104.87ms
http_reqs......................: 1 0.762132/s
iteration_duration.............: avg=1.31s min=1.31s med=1.31s max=1.31s p(90)=1.31s p(95)=1.31s
iterations.....................: 1 0.762132/s
vus............................: 1 min=1 max=1
vus_max........................: 1 min=1 max=1
running (00m01.3s), 0/1 VUs, 1 complete and 0 interrupted iterations
default ✓ [========================] 1 VUs 00m01.3s/10m0s 1/1 iters, 1 per VU
data_received..................: 17 kB 13 kB/s
data_sent......................: 438 B 334 B/s
http_req_blocked...............: avg=204.96ms min=204.96ms med=204.96ms max=204.96ms p(90)=204.96ms p(95)=204.96ms
http_req_connecting............: avg=97.58ms min=97.58ms med=97.58ms max=97.58ms p(90)=97.58ms p(95)=97.58ms
http_req_duration..............: avg=105.05ms min=105.05ms med=105.05ms max=105.05ms p(90)=105.05ms p(95)=105.05ms
{ expected_response:true }...: avg=105.05ms min=105.05ms med=105.05ms max=105.05ms p(90)=105.05ms p(95)=105.05ms
http_req_failed................: 0.00% ✓ 0 ✗ 1
http_req_receiving.............: avg=143µs min=143µs med=143µs max=143µs p(90)=143µs p(95)=143µs
http_req_sending...............: avg=39µs min=39µs med=39µs max=39µs p(90)=39µs p(95)=39µs
http_req_tls_handshaking.......: avg=106.12ms min=106.12ms med=106.12ms max=106.12ms p(90)=106.12ms p(95)=106.12ms
http_req_waiting...............: avg=104.87ms min=104.87ms med=104.87ms max=104.87ms p(90)=104.87ms p(95)=104.87ms
http_reqs......................: 1 0.762132/s
iteration_duration.............: avg=1.31s min=1.31s med=1.31s max=1.31s p(90)=1.31s p(95)=1.31s
iterations.....................: 1 0.762132/s
vus............................: 1 min=1 max=1
vus_max........................: 1 min=1 max=1
K6 CAPABILITIES
✓ CLI TOOLS
✓ SCRIPTING (JAVASCRIPT ES2015/ES6)
✓ MODULES
✓ CHECKS, THRESHOLDS & METRICS
✓ TEST SCENARIO & TEST EXECUTOR CUSTOMIZATION
✓ TEST BUILDER & BROWSER RECORDER
✓ RESULT STORAGE & VISUALIZATION INTEGRATIONS
SCALING UP ⬆ THE TESTS
$ k6 run -u 100 -d 1m script.js
import http from 'k6/http';
import { sleep } from 'k6';
export const options = {
vus: 100,
duration: '1m',
};
export default function () {
http.get('https://test.k6.io');
sleep(1);
}
VUS
TIME
ITERATIONS
THE HTTP REQUESTS
import http from 'k6/http';
export default function () {
http.get('https://test.k6.io');
}
import http from 'k6/http';
export default function () {
for (let id = 1; id <= 100; id++) {
http.get(`https://test.k6.io?id=${id}`);
}
}
import http from 'k6/http';
export default function () {
const params = {
cookies: { lang: 'nl' },
headers: { 'Accept-Language': 'nl' }
};
http.get('https://test.k6.io', params);
}
REQUEST PARAMETERS
✓ COOKIES & COOKIE JAR
✓ HEADERS
✓ AUTHENTICATION TYPE
✓ REDIRECTS
✓ TAGS
✓ TIMEOUT
✓ COMPRESSION
import http from 'k6/http';
export default function () {
let data = 'name=Thijs' ;
http.post('https://httpbin.test.k6.io/post', data);
}
import http from 'k6/http';
export default function () {
let data = { name: 'Thijs' };
http.post('https://httpbin.test.k6.io/post',
JSON.stringify(data), {
headers: { 'Content-Type': 'application/json' }
});
}
http.get(url, [params]);
http.head(url, [params]);
http.post(url, [body] [params]);
http.delete(url, [body] [params]);
http.patch(url, [body] [params]);
http.put(url, [body] [params]);
http.request(method, url, [body] [params]);
http.batch(array | object);
import http from 'k6/http';
import { check } from 'k6';
export default function () {
const responses = http.batch([
['GET', 'https://test.k6.io'],
['GET', 'https://test.k6.io/style.css'],
['GET', 'https://test.k6.io/images/logo.png'],
]);
check(responses[0], {
'main page status was 200': (res) => res.status === 200,
});
}
CHECKS ✅
import http from 'k6/http';
import { check } from 'k6';
export default function () {
const res = http.get('http://httpbin.test.k6.io');
check(res, {
'response code was 200': (res) => res.status == 200,
});
}
BOOL check(val, sets, [tags])
BOOL check(val, sets, [tags])
CREATES A
RATE METRIC
FALSE
ASSERTION
DOESN'T STOP THE
TEST RUN
BOOL check(res, {
'response code was 200': (res) => res.status == 200,
})
/ |‾‾| /‾‾/ /‾‾/
/ /  | |/ / / /
/ /  | ( / ‾‾
/  | |  | (‾) |
/ __________  |__| __ _____/ .io
execution: local
script: script.js
output: -
scenarios: (100.00%) 1 scenario, 1 max VUs, 10m30s max duration (incl. graceful stop):
* default: 1 iterations for each of 1 VUs (maxDuration: 10m0s, gracefulStop: 30s)
running (00m00.6s), 0/1 VUs, 1 complete and 0 interrupted iterations
default ✓ [======================================] 1 VUs 00m00.6s/10m0s 1/1 iters, 1 per VU
✓ response code was 200
checks.........................: 100.00% ✓ 1 ✗ 0
data_received..................: 16 kB 28 kB/s
data_sent......................: 574 B 1.0 kB/s
http_req_blocked...............: avg=173.28ms min=128.83ms med=173.28ms max=217.73ms p(90)=208.84ms p(95)=213.28ms
http_req_connecting............: avg=101.13ms min=99.15ms med=101.13ms max=103.11ms p(90)=102.71ms p(95)=102.91ms
http_req_duration..............: avg=104.05ms min=101.57ms med=104.05ms max=106.53ms p(90)=106.04ms p(95)=106.28ms
{ expected_response:true }...: avg=104.05ms min=101.57ms med=104.05ms max=106.53ms p(90)=106.04ms p(95)=106.28ms
http_req_failed................: 0.00% ✓ 0 ✗ 2
http_req_receiving.............: avg=939µs min=176µs med=939µs max=1.7ms p(90)=1.54ms p(95)=1.62ms
http_req_sending...............: avg=63.5µs min=33µs med=63.5µs max=94µs p(90)=87.9µs p(95)=90.95µs
http_req_tls_handshaking.......: avg=56.71ms min=0s med=56.71ms max=113.42ms p(90)=102.08ms p(95)=107.75ms
http_req_waiting...............: avg=103.05ms min=99.83ms med=103.05ms max=106.26ms p(90)=105.62ms p(95)=105.94ms
http_reqs......................: 2 3.577114/s
iteration_duration.............: avg=557.34ms min=557.34ms med=557.34ms max=557.34ms p(90)=557.34ms p(95)=557.34ms
iterations.....................: 1 1.788557/s
scenarios: (100.00%) 1 scenario, 1 max VUs, 10m30s max duration (incl. grace
* default: 1 iterations for each of 1 VUs (maxDuration: 10m0s, grac
running (00m00.6s), 0/1 VUs, 1 complete and 0 interrupted iterations
default ✓ [======================================] 1 VUs 00m00.6s/10m0s 1/1
✓ response code was 200
checks.........................: 100.00% ✓ 1 ✗ 0
data_received..................: 16 kB 28 kB/s
data_sent......................: 574 B 1.0 kB/s
http_req_blocked...............: avg=173.28ms min=128.83ms med=173.28ms m
http_req_connecting............: avg=101.13ms min=99.15ms med=101.13ms m
http_req_duration..............: avg=104.05ms min=101.57ms med=104.05ms m
{ expected_response:true }...: avg=104.05ms min=101.57ms med=104.05ms m
http_req_failed................: 0.00% ✓ 0 ✗ 2
http_req_receiving.............: avg=939µs min=176µs med=939µs m
http_req_sending...............: avg=63.5µs min=33µs med=63.5µs m
http_req_tls_handshaking.......: avg=56.71ms min=0s med=56.71ms m
http_req_waiting...............: avg=103.05ms min=99.83ms med=103.05ms m
/ |‾‾| /‾‾/ /‾‾/
/ /  | |/ / / /
/ /  | ( / ‾‾
/  | |  | (‾) |
/ __________  |__| __ _____/ .io
execution: local
script: script.js
output: -
scenarios: (100.00%) 1 scenario, 1 max VUs, 10m30s max duration (incl. graceful stop):
* default: 1 iterations for each of 1 VUs (maxDuration: 10m0s, gracefulStop: 30s)
running (00m00.6s), 0/1 VUs, 1 complete and 0 interrupted iterations
default ✓ [======================================] 1 VUs 00m00.6s/10m0s 1/1 iters, 1 per VU
✗ response code was 200
↳ 0% — ✓ 0 / ✗ 1
checks.........................: 0.00% ✓ 0 ✗ 1
data_received..................: 16 kB 26 kB/s
data_sent......................: 574 B 945 B/s
http_req_blocked...............: avg=192.27ms min=148.54ms med=192.27ms max=236ms p(90)=227.26ms p(95)=231.63ms
http_req_connecting............: avg=110.66ms min=110.02ms med=110.66ms max=111.31ms p(90)=111.18ms p(95)=111.25ms
http_req_duration..............: avg=109.19ms min=108.21ms med=109.19ms max=110.16ms p(90)=109.97ms p(95)=110.06ms
{ expected_response:true }...: avg=109.19ms min=108.21ms med=109.19ms max=110.16ms p(90)=109.97ms p(95)=110.06ms
http_req_failed................: 0.00% ✓ 0 ✗ 2
http_req_receiving.............: avg=1.11ms min=219µs med=1.11ms max=2ms p(90)=1.83ms p(95)=1.92ms
http_req_sending...............: avg=107.5µs min=35µs med=107.5µs max=180µs p(90)=165.5µs p(95)=172.75µs
http_req_tls_handshaking.......: avg=62.14ms min=0s med=62.14ms max=124.28ms p(90)=111.85ms p(95)=118.07ms
http_req_waiting...............: avg=107.97ms min=107.82ms med=107.97ms max=108.12ms p(90)=108.09ms p(95)=108.1ms
http_reqs......................: 2 3.293108/s
iteration_duration.............: avg=605.47ms min=605.47ms med=605.47ms max=605.47ms p(90)=605.47ms p(95)=605.47ms
iterations.....................: 1 1.646554/s
running (00m00.6s), 0/1 VUs, 1 complete and 0 interrupted iterations
default ✓ [======================================] 1 VUs 00m00.6s/10
✗ response code was 200
↳ 0% — ✓ 0 / ✗ 1
checks.........................: 0.00% ✓ 0 ✗ 1
data_received..................: 16 kB 26 kB/s
data_sent......................: 574 B 945 B/s
http_req_blocked...............: avg=192.27ms min=148.54ms med=1
http_req_connecting............: avg=110.66ms min=110.02ms med=1
http_req_duration..............: avg=109.19ms min=108.21ms med=1
{ expected_response:true }...: avg=109.19ms min=108.21ms med=1
http_req_failed................: 0.00% ✓ 0 ✗ 2
http_req_receiving.............: avg=1.11ms min=219µs med=1
http_req_sending...............: avg=107.5µs min=35µs med=1
THRESHOLDS
import http from 'k6/http';
import { sleep } from 'k6';
export const options = {
thresholds: {
http_req_failed: ['rate<0.01'],
http_req_duration: ['p(95)<200'],
},
};
export default function () {
http.get('https://test.k6.io');
sleep(1);
}
/ |‾‾| /‾‾/ /‾‾/
/ /  | |/ / / /
/ /  | ( / ‾‾
/  | |  | (‾) |
/ __________  |__| __ _____/ .io
execution: local
script: script.js
output: -
scenarios: (100.00%) 1 scenario, 1 max VUs, 10m30s max duration (incl. graceful stop):
* default: 1 iterations for each of 1 VUs (maxDuration: 10m0s, gracefulStop: 30s)
running (00m01.4s), 0/1 VUs, 1 complete and 0 interrupted iterations
default ✓ [======================================] 1 VUs 00m01.4s/10m0s 1/1 iters, 1 per VU
data_received..................: 17 kB 12 kB/s
data_sent......................: 438 B 321 B/s
http_req_blocked...............: avg=252.92ms min=252.92ms med=252.92ms max=252.92ms p(90)=252.92ms p(95)=252.92ms
http_req_connecting............: avg=103.95ms min=103.95ms med=103.95ms max=103.95ms p(90)=103.95ms p(95)=103.95ms
✓ http_req_duration..............: avg=106.92ms min=106.92ms med=106.92ms max=106.92ms p(90)=106.92ms p(95)=106.92ms
{ expected_response:true }...: avg=106.92ms min=106.92ms med=106.92ms max=106.92ms p(90)=106.92ms p(95)=106.92ms
✓ http_req_failed................: 0.00% ✓ 0 ✗ 1
http_req_receiving.............: avg=205µs min=205µs med=205µs max=205µs p(90)=205µs p(95)=205µs
http_req_sending...............: avg=40µs min=40µs med=40µs max=40µs p(90)=40µs p(95)=40µs
http_req_tls_handshaking.......: avg=114.34ms min=114.34ms med=114.34ms max=114.34ms p(90)=114.34ms p(95)=114.34ms
http_req_waiting...............: avg=106.67ms min=106.67ms med=106.67ms max=106.67ms p(90)=106.67ms p(95)=106.67ms
http_reqs......................: 1 0.733336/s
iteration_duration.............: avg=1.36s min=1.36s med=1.36s max=1.36s p(90)=1.36s p(95)=1.36s
iterations.....................: 1 0.733336/s
vus............................: 1 min=1 max=1
vus_max........................: 1 min=1 max=1
running (00m01.4s), 0/1 VUs, 1 complete and 0 interrupted iterations
default ✓ [======================================] 1 VUs 00m01.4s/10m0s 1/1 i
data_received..................: 17 kB 12 kB/s
data_sent......................: 438 B 321 B/s
http_req_blocked...............: avg=252.92ms min=252.92ms med=252.92ms ma
http_req_connecting............: avg=103.95ms min=103.95ms med=103.95ms ma
✓ http_req_duration..............: avg=106.92ms min=106.92ms med=106.92ms ma
{ expected_response:true }...: avg=106.92ms min=106.92ms med=106.92ms ma
✓ http_req_failed................: 0.00% ✓ 0 ✗ 1
http_req_receiving.............: avg=205µs min=205µs med=205µs ma
http_req_sending...............: avg=40µs min=40µs med=40µs ma
http_req_tls_handshaking.......: avg=114.34ms min=114.34ms med=114.34ms ma
http_req_waiting...............: avg=106.67ms min=106.67ms med=106.67ms ma
http_reqs......................: 1 0.733336/s
iteration_duration.............: avg=1.36s min=1.36s med=1.36s ma
iterations.....................: 1 0.733336/s
vus............................: 1 min=1 max=1
vus_max........................: 1 min=1 max=1
import http from 'k6/http';
import { sleep } from 'k6';
export const options = {
thresholds: {
http_req_failed: ['rate<0.01'],
http_req_duration: ['p(95)<90'],
},
};
export default function () {
http.get('https://test.k6.io');
sleep(1);
}
/ |‾‾| /‾‾/ /‾‾/
/ /  | |/ / / /
/ /  | ( / ‾‾
/  | |  | (‾) |
/ __________  |__| __ _____/ .io
execution: local
script: script.js
output: -
scenarios: (100.00%) 1 scenario, 1 max VUs, 10m30s max duration (incl. graceful stop):
* default: 1 iterations for each of 1 VUs (maxDuration: 10m0s, gracefulStop: 30s)
running (00m01.3s), 0/1 VUs, 1 complete and 0 interrupted iterations
default ✓ [======================================] 1 VUs 00m01.3s/10m0s 1/1 iters, 1 per VU
data_received..................: 17 kB 13 kB/s
data_sent......................: 438 B 327 B/s
http_req_blocked...............: avg=226.19ms min=226.19ms med=226.19ms max=226.19ms p(90)=226.19ms p(95)=226.19ms
http_req_connecting............: avg=106.05ms min=106.05ms med=106.05ms max=106.05ms p(90)=106.05ms p(95)=106.05ms
✗ http_req_duration..............: avg=111.29ms min=111.29ms med=111.29ms max=111.29ms p(90)=111.29ms p(95)=111.29ms
{ expected_response:true }...: avg=111.29ms min=111.29ms med=111.29ms max=111.29ms p(90)=111.29ms p(95)=111.29ms
✓ http_req_failed................: 0.00% ✓ 0 ✗ 1
http_req_receiving.............: avg=223µs min=223µs med=223µs max=223µs p(90)=223µs p(95)=223µs
http_req_sending...............: avg=39µs min=39µs med=39µs max=39µs p(90)=39µs p(95)=39µs
http_req_tls_handshaking.......: avg=119.04ms min=119.04ms med=119.04ms max=119.04ms p(90)=119.04ms p(95)=119.04ms
http_req_waiting...............: avg=111.03ms min=111.03ms med=111.03ms max=111.03ms p(90)=111.03ms p(95)=111.03ms
http_reqs......................: 1 0.746263/s
iteration_duration.............: avg=1.33s min=1.33s med=1.33s max=1.33s p(90)=1.33s p(95)=1.33s
iterations.....................: 1 0.746263/s
vus............................: 1 min=1 max=1
vus_max........................: 1 min=1 max=1
ERRO[0001] some thresholds have failed
running (00m01.3s), 0/1 VUs, 1 complete and 0 interrupted iterations
default ✓ [======================================] 1 VUs 00m01.3s/10m0s 1/1 iters,
data_received..................: 17 kB 13 kB/s
data_sent......................: 438 B 327 B/s
http_req_blocked...............: avg=226.19ms min=226.19ms med=226.19ms max=226
http_req_connecting............: avg=106.05ms min=106.05ms med=106.05ms max=106
✗ http_req_duration..............: avg=111.29ms min=111.29ms med=111.29ms max=111
{ expected_response:true }...: avg=111.29ms min=111.29ms med=111.29ms max=111
✓ http_req_failed................: 0.00% ✓ 0 ✗ 1
http_req_receiving.............: avg=223µs min=223µs med=223µs max=223
http_req_sending...............: avg=39µs min=39µs med=39µs max=39µ
http_req_tls_handshaking.......: avg=119.04ms min=119.04ms med=119.04ms max=119
http_req_waiting...............: avg=111.03ms min=111.03ms med=111.03ms max=111
http_reqs......................: 1 0.746263/s
iteration_duration.............: avg=1.33s min=1.33s med=1.33s max=1.3
iterations.....................: 1 0.746263/s
vus............................: 1 min=1 max=1
vus_max........................: 1 min=1 max=1
ERRO[0001] some thresholds have failed
lete and 0 interrupted iterations
==============] 1 VUs 00m01.3s/10m0s 1/1 iters, 1 per VU
.: 17 kB 13 kB/s
.: 438 B 327 B/s
.: avg=226.19ms min=226.19ms med=226.19ms max=226.19ms p(90)=226.19ms p(95)=226.19ms
.: avg=106.05ms min=106.05ms med=106.05ms max=106.05ms p(90)=106.05ms p(95)=106.05ms
.: avg=111.29ms min=111.29ms med=111.29ms max=111.29ms p(90)=111.29ms p(95)=111.29ms
.: avg=111.29ms min=111.29ms med=111.29ms max=111.29ms p(90)=111.29ms p(95)=111.29ms
.: 0.00% ✓ 0 ✗ 1
.: avg=223µs min=223µs med=223µs max=223µs p(90)=223µs p(95)=223µs
.: avg=39µs min=39µs med=39µs max=39µs p(90)=39µs p(95)=39µs
.: avg=119.04ms min=119.04ms med=119.04ms max=119.04ms p(90)=119.04ms p(95)=119.04ms
.: avg=111.03ms min=111.03ms med=111.03ms max=111.03ms p(90)=111.03ms p(95)=111.03ms
.: 1 0.746263/s
.: avg=1.33s min=1.33s med=1.33s max=1.33s p(90)=1.33s p(95)=1.33s
.: 1 0.746263/s
.: 1 min=1 max=1
.: 1 min=1 max=1
led
import http from 'k6/http';
import { sleep } from 'k6';
export const options = {
thresholds: {
http_req_duration: ['p(90) < 400', 'p(95) < 800',
'p(99.9) < 2000']
},
};
export default function () {
http.get('https://test.k6.io');
sleep(1);
}
T A G S
CATEGORIZE CHECKS,
THRESHOLDS, METRICS &
REQUESTS
SYSTEM TAGS
✓PROTO
✓SUBPROTO
✓STATUS
✓METHOD
✓URL
✓NAME
✓GROUP
✓CHECK
✓ERROR
✓ERROR_CODE
✓TLS_VERSION
✓SCENARIO
✓SERVICE
✓EXPECTED
RESPONSE
import http from 'k6/http';
import { sleep } from 'k6';
export default function () {
http.get('https://test.k6.io', {
tags: {
location: "eu",
},
}
);
sleep(1);
}
import http from 'k6/http';
import { sleep } from 'k6';
export const options = {
tags: {
location: 'eu',
},
};
export default function () {
http.get('https://test.k6.io');
sleep(1);
}
$ k6 run script.js --tag location="eu"
import http from 'k6/http';
import { sleep } from 'k6';
import exec from 'k6/execution';
export function setup () {
var location = 'eu';
switch(exec.vu.tags['location']) {
case 'us':
case 'apac':
case 'eu':
location = exec.vu.tags['location'];
}
return {"location": location};
}
export default function (data) {
var res = http.get(`https://${data.location}.test.com/`);
console.log(res.request.url);
sleep(1);
}
import http from 'k6/http';
export const options = {
thresholds: {
'http_req_duration': ['p(95)<500'],
'http_req_duration{location:eu}': ['p(95)<400'],
'http_req_duration{location:us}': ['p(95)<200'],
},
};
export default function () {
http.get('https://test.k6.io/');
}
THRESHOLDS
PER TAG
GROUPS
import http from 'k6/http';
import { sleep } from 'k6';
import { group } from 'k6';
import { check } from 'k6';
export default function (data) {
let res;
group('get', function () {
res = http.get('https://test.k6.io/contacts.php');
check(res, {
'is contacts status 200': (r) => r.status === 200,
});
res = http.get('https://test.k6.io/news.php');
check(res, {
'is news status 200': (r) => r.status === 200,
});
sleep(1);
});
group('post', function () {
res = http.post('https://test.k6.io/flip_coin.php', 'bet=heads');
check(res, {
'is heads status 200': (r) => r.status === 200,
});
res = http.post('https://test.k6.io/flip_coin.php', 'bet=tails');
check(res, {
'is tails status 200': (r) => r.status === 200,
});
sleep(1);
});
}
group('post', function () {
res = http.post('https://test.k6.io/flip_coin.php', 'bet=heads');
check(res, {
'is heads status 200': (r) => r.status === 200,
});
res = http.post('https://test.k6.io/flip_coin.php', 'bet=tails');
check(res, {
'is tails status 200': (r) => r.status === 200,
});
sleep(1);
});
}
GROUP NAME IS
ADDED AS A TAG
/ |‾‾| /‾‾/ /‾‾/
/ /  | |/ / / /
/ /  | ( / ‾‾
/  | |  | (‾) |
/ __________  |__| __ _____/ .io
execution: local
script: script.js
output: -
scenarios: (100.00%) 1 scenario, 1 max VUs, 10m30s max duration (incl. graceful stop):
* default: 1 iterations for each of 1 VUs (maxDuration: 10m0s, gracefulStop: 30s)
running (00m02.7s), 0/1 VUs, 1 complete and 0 interrupted iterations
default [======================================] 1 VUs 00m02.7s/10m0s 1/1 iters, 1 per VU
█ get
✓ is contacts status 200
✓ is news status 200
█ post
✓ is heads status 200
✓ is tails status 200
checks.........................: 100.00% ✓ 4 ✗ 0
data_received..................: 9.6 kB 3.6 kB/s
data_sent......................: 836 B 309 B/s
group_duration.................: avg=1.35s min=1.21s med=1.35s max=1.48s p(90)=1.45s p(95)=1.47s
http_req_blocked...............: avg=65.78ms min=4µs med=6µs max=263.13ms p(90)=184.19ms p(95)=223.66ms
http_req_connecting............: avg=26.74ms min=0s med=0s max=106.96ms p(90)=74.87ms p(95)=90.91ms
http_req_duration..............: avg=108.23ms min=102.12ms med=109.73ms max=111.35ms p(90)=110.94ms p(95)=111.14ms
{ expected_response:true }...: avg=108.23ms min=102.12ms med=109.73ms max=111.35ms p(90)=110.94ms p(95)=111.14ms
http_req_failed................: 0.00% ✓ 0 ✗ 4
http_req_receiving.............: avg=154.5µs min=88µs med=138.5µs max=253µs p(90)=221.8µs p(95)=237.4µs
http_req_sending...............: avg=96.25µs min=19µs med=30.5µs max=305µs p(90)=224.3µs p(95)=264.64µs
http_req_tls_handshaking.......: avg=29.42ms min=0s med=0s max=117.71ms p(90)=82.4ms p(95)=100.06ms
http_req_waiting...............: avg=107.98ms min=101.93ms med=109.38ms max=111.24ms p(90)=110.69ms p(95)=110.96ms
http_reqs......................: 4 1.479629/s
iteration_duration.............: avg=2.7s min=2.7s med=2.7s max=2.7s p(90)=2.7s p(95)=2.7s
iterations.....................: 1 0.369907/s
vus............................: 1 min=1 max=1
vus_max........................: 1 min=1 max=1
█ get
✓ is contacts status 200
✓ is news status 200
█ post
✓ is heads status 200
✓ is tails status 200
checks.........................: 100.00% ✓ 4 ✗ 0
data_received..................: 9.6 kB 3.6 kB/s
data_sent......................: 836 B 309 B/s
group_duration.................: avg=1.35s min=1.21s med=1.35s max=1.48s p(90)=1
http_req_blocked...............: avg=65.78ms min=4µs med=6µs max=263.13ms p(90)=1
http_req_connecting............: avg=26.74ms min=0s med=0s max=106.96ms p(90)=7
http_req_duration..............: avg=108.23ms min=102.12ms med=109.73ms max=111.35ms p(90)=1
{ expected_response:true }...: avg=108.23ms min=102.12ms med=109.73ms max=111.35ms p(90)=1
http_req_failed................: 0.00% ✓ 0 ✗ 4
http_req_receiving.............: avg=154.5µs min=88µs med=138.5µs max=253µs p(90)=2
http_req_sending...............: avg=96.25µs min=19µs med=30.5µs max=305µs p(90)=2
http_req_tls_handshaking.......: avg=29.42ms min=0s med=0s max=117.71ms p(90)=8
http_req_waiting...............: avg=107.98ms min=101.93ms med=109.38ms max=111.24ms p(90)=1
TEST LIFECYCLE ♻
// 1. init code
export function setup() {
// 2. setup code
}
export default function (data) {
// 3. VU code
}
export function teardown(data) {
// 4. teardown code
}
// 1. init code
export function setup() {
// 2. setup code
}
export default function (data) {
// 3. VU code
}
export function teardown(data) {
// 4. teardown code
}
ONCER PER VU
// 1. init code
export function setup() {
// 2. setup code
}
export default function (data) {
// 3. VU code
}
export function teardown(data) {
// 4. teardown code
}
ONCER PER VU
ONCE
// 1. init code
export function setup() {
// 2. setup code
}
export default function (data) {
// 3. VU code
}
export function teardown(data) {
// 4. teardown code
}
ONCER PER VU
ONCE
ONCE PER
ITERATION
// 1. init code
export function setup() {
// 2. setup code
}
export default function (data) {
// 3. VU code
}
export function teardown(data) {
// 4. teardown code
}
ONCE
ONCER PER VU
ONCE
ONCE PER
ITERATION
// 1. init code
import http from 'k6/http';
export function setup() {
// 2. setup code
const res = http.get('https://httpbin.test.k6.io/json');
return { 'slides': res.json().slideshow.slides}
}
export default function (data) {
// 3. VU code
data.slides.forEach((slide) => {
const res = http.get(`https://httpbin.test.k6.io/anything/${slide.title}}`);
});
}
export function teardown(data) {
// 4. teardown code
console.log('Test finished, ' + data.slides.length + ' slides processed.');
}
ACCESS METRICS
import http from 'k6/http';
export default function () {
const res = http.get('http://httpbin.test.k6.io');
console.log('Response time was ' +
String(res.timings.duration) + ' ms');
}
import http from 'k6/http';
export default function () {
const res = http.get('http://httpbin.test.k6.io');
console.log('Response time was ' +
String(res.timings.duration) + ' ms');
}
res.timings.blocked
res.timings.connecting
res.timings.tls_handshaking
res.timings.sending
res.timings.waiting
res.timings.receiving
res.timings.duration
CUSTOM METRICS
import http from 'k6/http';
import { Counter } from 'k6/metrics';
import { randomItem } from 'https://jslib.k6.io/k6-utils/1.2.0/index.js';
const res200 = new Counter('res200');
const res300 = new Counter('res300');
const res400 = new Counter('res400');
const res500 = new Counter('res500');
const statuses = [200, 300, 400, 500];
export default function () {
let res, status;
for (let id = 1; id <= 20; id++) {
status = randomItem(statuses);
res = http.get(`https://httpbin.test.k6.io/status/${status}`);
if(res.status >= 200 && res.status < 300) {
res200.add(1);
} else if(res.status >= 300 && res.status < 400) {
res300.add(1);
} else if(res.status >= 400 && res.status < 500) {
res400.add(1);
} else if(res.status >= 500 && res.status < 600) {
res500.add(1);
}
}
}
data_received..................: 10 kB 4.7 kB/s
data_sent......................: 2.7 kB 1.2 kB/s
http_req_blocked...............: avg=11.58ms min=1µs med=5.5µs max=231.65ms p(90)=9.
http_req_connecting............: avg=4.81ms min=0s med=0s max=96.32ms p(90)=0s
http_req_duration..............: avg=98.32ms min=93.82ms med=99.33ms max=101.34ms p(90)=10
{ expected_response:true }...: avg=98.63ms min=94.89ms med=99.53ms max=101.34ms p(90)=10
http_req_failed................: 50.00% ✓ 10 ✗ 10
http_req_receiving.............: avg=113.95µs min=20µs med=95.5µs max=258µs p(90)=22
http_req_sending...............: avg=22.4µs min=8µs med=22µs max=47µs p(90)=31
http_req_tls_handshaking.......: avg=5.15ms min=0s med=0s max=103.18ms p(90)=0s
http_req_waiting...............: avg=98.18ms min=93.71ms med=99.12ms max=101.1ms p(90)=10
http_reqs......................: 20 9.070484/s
iteration_duration.............: avg=2.2s min=2.2s med=2.2s max=2.2s p(90)=2.
iterations.....................: 1 0.453524/s
res200.........................: 6 2.721145/s
res300.........................: 4 1.814097/s
res400.........................: 8 3.628194/s
res500.........................: 2 0.907048/s
vus............................: 1 min=1 max=1
vus_max........................: 1 min=1 max=1
CUSTOM METRIC TYPES
✓COUNTER CUMULATIVE SUM OF VALUES
✓GAUGE MIN, MAX & LAST VALUE
✓RATE PERCENTAGE OF NON-ZERO VALUES
✓TREND MIN, MAX, AVERAGE & PERCENTILES
END OF TEST METRICS
/ |‾‾| /‾‾/ /‾‾/
/ /  | |/ / / /
/ /  | ( / ‾‾
/  | |  | (‾) |
/ __________  |__| __ _____/ .io
execution: local
script: script.js
output: -
scenarios: (100.00%) 1 scenario, 1 max VUs, 10m30s max duration (incl. graceful stop):
* default: 1 iterations for each of 1 VUs (maxDuration: 10m0s, gracefulStop: 30s)
running (00m01.3s), 0/1 VUs, 1 complete and 0 interrupted iterations
default ✓ [========================] 1 VUs 00m01.3s/10m0s 1/1 iters, 1 per VU
data_received..................: 17 kB 13 kB/s
data_sent......................: 438 B 334 B/s
http_req_blocked...............: avg=204.96ms min=204.96ms med=204.96ms max=204.96ms p(90)=204.96ms p(95)=204.96ms
http_req_connecting............: avg=97.58ms min=97.58ms med=97.58ms max=97.58ms p(90)=97.58ms p(95)=97.58ms
http_req_duration..............: avg=105.05ms min=105.05ms med=105.05ms max=105.05ms p(90)=105.05ms p(95)=105.05ms
{ expected_response:true }...: avg=105.05ms min=105.05ms med=105.05ms max=105.05ms p(90)=105.05ms p(95)=105.05ms
http_req_failed................: 0.00% ✓ 0 ✗ 1
http_req_receiving.............: avg=143µs min=143µs med=143µs max=143µs p(90)=143µs p(95)=143µs
http_req_sending...............: avg=39µs min=39µs med=39µs max=39µs p(90)=39µs p(95)=39µs
http_req_tls_handshaking.......: avg=106.12ms min=106.12ms med=106.12ms max=106.12ms p(90)=106.12ms p(95)=106.12ms
http_req_waiting...............: avg=104.87ms min=104.87ms med=104.87ms max=104.87ms p(90)=104.87ms p(95)=104.87ms
http_reqs......................: 1 0.762132/s
iteration_duration.............: avg=1.31s min=1.31s med=1.31s max=1.31s p(90)=1.31s p(95)=1.31s
iterations.....................: 1 0.762132/s
vus............................: 1 min=1 max=1
vus_max........................: 1 min=1 max=1
YOU KNOW
THIS ONE
import http from 'k6/http';
export const options = {
summaryTrendStats: ['avg', 'min', 'max', 'count'],
};
export default function () {
http.get('https://test.k6.io/');
}
REDUCE
TRENDS
/ |‾‾| /‾‾/ /‾‾/
/ /  | |/ / / /
/ /  | ( / ‾‾
/  | |  | (‾) |
/ __________  |__| __ _____/ .io
execution: local
script: script.js
output: -
scenarios: (100.00%) 1 scenario, 1 max VUs, 10m30s max duration (incl. graceful stop):
* default: 1 iterations for each of 1 VUs (maxDuration: 10m0s, gracefulStop: 30s)
running (00m00.4s), 0/1 VUs, 1 complete and 0 interrupted iterations
default ✓ [======================================] 1 VUs 00m00.4s/10m0s 1/1 iters, 1 per VU
data_received..................: 17 kB 47 kB/s
data_sent......................: 438 B 1.2 kB/s
http_req_blocked...............: avg=256.46ms min=256.46ms max=256.46ms
http_req_connecting............: avg=104.35ms min=104.35ms max=104.35ms
http_req_duration..............: avg=106ms min=106ms max=106ms
{ expected_response:true }...: avg=106ms min=106ms max=106ms
http_req_failed................: 0.00% ✓ 0 ✗ 1
http_req_receiving.............: avg=1.1ms min=1.1ms max=1.1ms
http_req_sending...............: avg=34µs min=34µs max=34µs
http_req_tls_handshaking.......: avg=121.56ms min=121.56ms max=121.56ms
http_req_waiting...............: avg=104.86ms min=104.86ms max=104.86ms
http_reqs......................: 1 2.74597/s
iteration_duration.............: avg=362.78ms min=362.78ms max=362.78ms
iterations.....................: 1 2.74597/s
$ k6 run --summary-trend-
stats="avg,min,max" script.js
$ k6 run --no-summary script.js
$ k6 run --out json script.js
$ k6 run --out json=k6.json script.js
$ k6 run --out csv=k6.csv script.js
REAL TIME METRICS
RESULT STORES & VISUALIZATIONS
✓JSON
✓CSV
✓AMAZON
CLOUDWATCH
✓INFLUXDB
✓NEW RELIC
✓STATSD
✓APACHE
KAFKA
✓DATADOG
✓PROMETHEUS
✓CLOUD
✓GRAFANA
CLOUD
✓NETDATA
✓TIMESCALEDB
$ go install go.k6.io/xk6/cmd/xk6@latest
$ ~/go/bin/xk6 build v0.36.0 --with github.com/
szkiba/xk6-prometheus@latest
$ k6 run -o "prometheus=namespace=k6&port=9090"
$ curl http://localhost:9090
# HELP k6_data_received The amount of received data
# TYPE k6_data_received counter
k6_data_received 8.4039802e+07
# HELP k6_data_sent The amount of data sent
# TYPE k6_data_sent counter
k6_data_sent 803484
# HELP k6_http_req_blocked Time spent blocked before initiating the request
# TYPE k6_http_req_blocked summary
k6_http_req_blocked{quantile="0.5"} 0.001541
k6_http_req_blocked{quantile="0.9"} 0.003791
k6_http_req_blocked{quantile="0.95"} 0.012
k6_http_req_blocked{quantile="1"} 1096.216625
k6_http_req_blocked_sum 154652.24431000135
k6_http_req_blocked_count 7432
# HELP k6_http_req_blocked_current Time spent blocked before initiating the request
(current)
# TYPE k6_http_req_blocked_current gauge
k6_http_req_blocked_current 0.001667
# HELP k6_http_req_connecting Time spent establishing TCP connection
# TYPE k6_http_req_connecting summary
k6_http_req_connecting{quantile="0.5"} 0
k6_http_req_connecting{quantile="0.9"} 0
k6_http_req_connecting{quantile="0.95"} 0
k6_http_req_connecting{quantile="1"} 138.566084
k6_http_req_connecting_sum 36255.94142099999
k6_http_req_connecting_count 7432
PROMETHEUS
OUTPUT
# HELP k6_http_req_receiving_current Time spent receiving response data (current)
# TYPE k6_http_req_receiving_current gauge
k6_http_req_receiving_current 0.029083
# HELP k6_http_req_sending Time spent sending data
# TYPE k6_http_req_sending summary
k6_http_req_sending{quantile="0.5"} 0.006375
k6_http_req_sending{quantile="0.9"} 0.016209
k6_http_req_sending{quantile="0.95"} 0.024875
k6_http_req_sending{quantile="1"} 0.618167
k6_http_req_sending_sum 76.60019499999983
k6_http_req_sending_count 7432
# HELP k6_http_req_sending_current Time spent sending data (current)
# TYPE k6_http_req_sending_current gauge
k6_http_req_sending_current 0.008167
# HELP k6_http_req_tls_handshaking Time spent handshaking TLS session
# TYPE k6_http_req_tls_handshaking summary
k6_http_req_tls_handshaking{quantile="0.5"} 0
k6_http_req_tls_handshaking{quantile="0.9"} 0
k6_http_req_tls_handshaking{quantile="0.95"} 0
k6_http_req_tls_handshaking{quantile="1"} 933.331792
k6_http_req_tls_handshaking_sum 108611.02479299998
k6_http_req_tls_handshaking_count 7432
# HELP k6_http_req_tls_handshaking_current Time spent handshaking TLS session (current)
# TYPE k6_http_req_tls_handshaking_current gauge
k6_http_req_tls_handshaking_current 0
# HELP k6_http_req_waiting Time spent waiting for response
# TYPE k6_http_req_waiting summary
k6_http_req_waiting{quantile="0.5"} 100.567167
$ k6 run hls.js -o
"prometheus=namespace=k6&port=9090"
$ k6 run hls.js -o
"prometheus=namespace=k6&port=9090"
$ k6 run hls.js -o
"prometheus=namespace=k6&port=9090"
global:
scrape_interval: 5s
scrape_timeout: 5s
evaluation_interval: 10s
scrape_configs:
- job_name: k6-dublin
static_configs:
- targets: ['k6-dublin.test.com:9090']
labels:
location: 'ir'
- job_name: k6-california
static_configs:
- targets: ['k6-california.test.com:9090']
labels:
location: 'us'
- job_name: k6-singapore
static_configs:
- targets: ['k6-singapore.test.com:9090']
labels:
location: 'sg'
k6_http_req_duration{location="ir", quantile="0.5"} 3.243162
k6_http_req_duration{location="ir", quantile="0.9"} 66.362954
k6_http_req_duration{location="ir", quantile="0.95"} 75.922755
k6_http_req_duration{location="ir", quantile="1"} 174.131426
k6_http_req_duration{location="us", quantile="0.5"} 3.987286
k6_http_req_duration{location="us", quantile="0.9"} 59.605656
k6_http_req_duration{location="us", quantile="0.95"} 75.764216
k6_http_req_duration{location="us", quantile="1"} 127.388737
LABELS
k6_vus
sum(rate(k6_http_reqs[$__rate_interval])) by (country)
rate(k6_http_req_failed_sum[$__rate_interval])
k6_http_req_waiting_current
k6_http_req_duration_current
rate(k6_data_received[$__rate_interval])*8
DISTRIBUTED TESTS
$ k6 run script.js -a :6565 -o
"prometheus=namespace=k6&port=9090" --paused
$ k6 run script.js -a :6565 -o
"prometheus=namespace=k6&port=9090" --paused
$ k6 run script.js -a :6565 -o
"prometheus=namespace=k6&port=9090" --paused
import http from 'k6/http';
export const options = {
scenarios: {
contacts: {
executor: 'externally-controlled',
vus: 2,
maxVUs: 5000,
duration: '2h',
},
},
}
export default function (data) {
const res = http.get('https://test.k6.io/');
}
$ k6 resume -a ireland.test.com:6565
status: 4
paused: "false"
vus: "0"
vus-max: "5000"
stopped: false
running: false
tainted: false
$ k6 scale -u 100 -a ireland.test.com:6565
status: 7
paused: "false"
vus: "100"
vus-max: "5000"
stopped: false
running: true
tainted: false
$ k6 resume -a us.test.com:6565
status: 4
paused: "false"
vus: "0"
vus-max: "5000"
stopped: false
running: false
tainted: false
$ k6 scale -u 100 -a us.test.com:6565
status: 7
paused: "false"
vus: "100"
vus-max: "5000"
stopped: false
running: true
tainted: false
$ k6 resume -a singapore.test.com:6565
status: 4
paused: "false"
vus: "0"
vus-max: "5000"
stopped: false
running: false
tainted: false
$ k6 scale -u 100 -a singapore.test.com:6565
status: 7
paused: "false"
vus: "100"
vus-max: "5000"
stopped: false
running: true
tainted: false
$ curl -X GET 
http://ireland.test.com:6565/v1/status
{"data":{"type":"status","id":"default","attributes":
{"status":7,"paused":false,"vus":100,"vus-
max":5000,"stopped":false,"running":true,"tainted":false}}}
$ curl -X PATCH 
http://california.test.com:6565/v1/status 
-H 'Content-Type: application/json' 
-d '{
"data": {
"attributes": {
"vus": 500
}
}
}'
{"data":{"type":"status","id":"default","attributes":
{"status":7,"paused":false,"vus":500,"vus-
max":5000,"stopped":false,"running":true,"tainted":false}}}
$ curl -X GET 
http://ireland.test.com:6565/v1/metrics/http_req_duration
{"data":
{"type":"metrics","id":"http_req_duration","attributes":
{"type":"trend","contains":"time","tainted":null,"sample":
{"avg":108.10542307692306,"max":116.119,"med":107.834,"min":1
02.749,"p(90)":111.269,"p(95)":113.75349999999999}}}}
SCENARIOS
VUS
TIME
ITERATIONS
SCENARIO PARAMETERS
✓VU
✓ITERATIONS
✓DURATION
✓START TIME
✓EXECUTOR
EXECUTORS
✓ SHARED ITERATIONS
✓ PER VU ITERATIONS
✓ CONSTANT VUS
✓ RAMPING VUS
✓ CONSTANT ARRIVAL RATE
✓ RAMPING ARRIVAL RATE
✓ EXTERNALLY
CONTROLLED
import http from 'k6/http';
import { sleep } from 'k6';
export const options = {
discardResponseBodies: true,
scenarios: {
contacts: {
executor: 'shared-iterations',
vus: 10,
iterations: 200,
maxDuration: '30s',
},
},
};
export default function () {
http.get('https://test.k6.io/contacts.php');
sleep(0.5);
}
import http from 'k6/http';
import { sleep } from 'k6';
export const options = {
discardResponseBodies: true,
scenarios: {
contacts: {
executor: 'per-vu-iterations',
vus: 10,
iterations: 20,
maxDuration: '30s',
},
},
};
export default function () {
http.get('https://test.k6.io/contacts.php');
sleep(0.5);
}
LOWER
EFFICIENCY DUE TO
IDLE VUS
import http from 'k6/http';
import { sleep } from 'k6';
export const options = {
discardResponseBodies: true,
scenarios: {
contacts: {
executor: 'constant-vus',
vus: 10,
duration: '30s',
},
},
};
export default function () {
http.get('https://test.k6.io/contacts.php');
sleep(0.5);
}
600 ITERATIONS
import http from 'k6/http';
import { sleep } from 'k6';
export const options = {
discardResponseBodies: true,
scenarios: {
contacts: {
executor: 'ramping-vus',
startVUs: 0,
stages: [
{ duration: '20s', target: 10 },
{ duration: '10s', target: 0 },
],
gracefulRampDown: '0s',
},
},
};
export default function () {
http.get('https://test.k6.io/contacts.php');
sleep(0.5);
}
import http from 'k6/http';
import { sleep } from 'k6';
export const options = {
discardResponseBodies: true,
scenarios: {
contacts: {
executor: 'constant-arrival-rate',
duration: '30s',
rate: 30,
timeUnit: '1s',
preAllocatedVUs: 2,
maxVUs: 50,
},
},
};
export default function () {
http.get('https://test.k6.io/contacts.php');
sleep(0.5);
}
FOCUS ON
ITERATIONS PER
SECOND
900
ITERATIONS
import http from 'k6/http';
export const options = {
discardResponseBodies: true,
scenarios: {
contacts: {
executor: 'externally-controlled',
vus: 10,
maxVUs: 50,
duration: '10m',
},
},
};
export default function () {
http.get('https://test.k6.io/contacts.php');
}
DEMO TIME
Distributed load testing with k6

More Related Content

What's hot

Lambdas and Streams Master Class Part 2
Lambdas and Streams Master Class Part 2Lambdas and Streams Master Class Part 2
Lambdas and Streams Master Class Part 2José Paumard
 
Testing RESTful Webservices using the REST-assured framework
Testing RESTful Webservices using the REST-assured frameworkTesting RESTful Webservices using the REST-assured framework
Testing RESTful Webservices using the REST-assured frameworkMicha Kops
 
How to test infrastructure code: automated testing for Terraform, Kubernetes,...
How to test infrastructure code: automated testing for Terraform, Kubernetes,...How to test infrastructure code: automated testing for Terraform, Kubernetes,...
How to test infrastructure code: automated testing for Terraform, Kubernetes,...Yevgeniy Brikman
 
A Hands-on Introduction on Terraform Best Concepts and Best Practices
A Hands-on Introduction on Terraform Best Concepts and Best Practices A Hands-on Introduction on Terraform Best Concepts and Best Practices
A Hands-on Introduction on Terraform Best Concepts and Best Practices Nebulaworks
 
Scaling up task processing with Celery
Scaling up task processing with CeleryScaling up task processing with Celery
Scaling up task processing with CeleryNicolas Grasset
 
Towards Functional Programming through Hexagonal Architecture
Towards Functional Programming through Hexagonal ArchitectureTowards Functional Programming through Hexagonal Architecture
Towards Functional Programming through Hexagonal ArchitectureCodelyTV
 
Easy Cloud Native Transformation with Nomad
Easy Cloud Native Transformation with NomadEasy Cloud Native Transformation with Nomad
Easy Cloud Native Transformation with NomadBram Vogelaar
 
API Test Automation using Karate.pdf
API Test Automation using Karate.pdfAPI Test Automation using Karate.pdf
API Test Automation using Karate.pdfVenessa Serrao
 
Inverting The Testing Pyramid
Inverting The Testing PyramidInverting The Testing Pyramid
Inverting The Testing PyramidNaresh Jain
 
Terraform introduction
Terraform introductionTerraform introduction
Terraform introductionJason Vance
 
Apache Airflow in Production
Apache Airflow in ProductionApache Airflow in Production
Apache Airflow in ProductionRobert Sanders
 
Mocking APIs Collaboratively with Postman
Mocking APIs Collaboratively with PostmanMocking APIs Collaboratively with Postman
Mocking APIs Collaboratively with PostmanNordic APIs
 
Test Design and Automation for REST API
Test Design and Automation for REST APITest Design and Automation for REST API
Test Design and Automation for REST APIIvan Katunou
 
Terraform modules restructured
Terraform modules restructuredTerraform modules restructured
Terraform modules restructuredAmi Mahloof
 
Terraform -- Infrastructure as Code
Terraform -- Infrastructure as CodeTerraform -- Infrastructure as Code
Terraform -- Infrastructure as CodeMartin Schütte
 
炎炎夏日學 Android 課程 - Part1: Kotlin 語法介紹
炎炎夏日學 Android 課程 -  Part1: Kotlin 語法介紹炎炎夏日學 Android 課程 -  Part1: Kotlin 語法介紹
炎炎夏日學 Android 課程 - Part1: Kotlin 語法介紹Johnny Sung
 
Karate - powerful and simple framework for REST API automation testing
Karate - powerful and simple framework for REST API automation testingKarate - powerful and simple framework for REST API automation testing
Karate - powerful and simple framework for REST API automation testingRoman Liubun
 

What's hot (20)

Lambdas and Streams Master Class Part 2
Lambdas and Streams Master Class Part 2Lambdas and Streams Master Class Part 2
Lambdas and Streams Master Class Part 2
 
Laravel Unit Testing
Laravel Unit TestingLaravel Unit Testing
Laravel Unit Testing
 
Testing RESTful Webservices using the REST-assured framework
Testing RESTful Webservices using the REST-assured frameworkTesting RESTful Webservices using the REST-assured framework
Testing RESTful Webservices using the REST-assured framework
 
How to test infrastructure code: automated testing for Terraform, Kubernetes,...
How to test infrastructure code: automated testing for Terraform, Kubernetes,...How to test infrastructure code: automated testing for Terraform, Kubernetes,...
How to test infrastructure code: automated testing for Terraform, Kubernetes,...
 
A Hands-on Introduction on Terraform Best Concepts and Best Practices
A Hands-on Introduction on Terraform Best Concepts and Best Practices A Hands-on Introduction on Terraform Best Concepts and Best Practices
A Hands-on Introduction on Terraform Best Concepts and Best Practices
 
Scaling up task processing with Celery
Scaling up task processing with CeleryScaling up task processing with Celery
Scaling up task processing with Celery
 
Towards Functional Programming through Hexagonal Architecture
Towards Functional Programming through Hexagonal ArchitectureTowards Functional Programming through Hexagonal Architecture
Towards Functional Programming through Hexagonal Architecture
 
Easy Cloud Native Transformation with Nomad
Easy Cloud Native Transformation with NomadEasy Cloud Native Transformation with Nomad
Easy Cloud Native Transformation with Nomad
 
API Test Automation using Karate.pdf
API Test Automation using Karate.pdfAPI Test Automation using Karate.pdf
API Test Automation using Karate.pdf
 
Infrastructure as Code
Infrastructure as CodeInfrastructure as Code
Infrastructure as Code
 
Inverting The Testing Pyramid
Inverting The Testing PyramidInverting The Testing Pyramid
Inverting The Testing Pyramid
 
Terraform introduction
Terraform introductionTerraform introduction
Terraform introduction
 
Apache Airflow in Production
Apache Airflow in ProductionApache Airflow in Production
Apache Airflow in Production
 
Mocking APIs Collaboratively with Postman
Mocking APIs Collaboratively with PostmanMocking APIs Collaboratively with Postman
Mocking APIs Collaboratively with Postman
 
Test Design and Automation for REST API
Test Design and Automation for REST APITest Design and Automation for REST API
Test Design and Automation for REST API
 
Terraform modules restructured
Terraform modules restructuredTerraform modules restructured
Terraform modules restructured
 
Terraform
TerraformTerraform
Terraform
 
Terraform -- Infrastructure as Code
Terraform -- Infrastructure as CodeTerraform -- Infrastructure as Code
Terraform -- Infrastructure as Code
 
炎炎夏日學 Android 課程 - Part1: Kotlin 語法介紹
炎炎夏日學 Android 課程 -  Part1: Kotlin 語法介紹炎炎夏日學 Android 課程 -  Part1: Kotlin 語法介紹
炎炎夏日學 Android 課程 - Part1: Kotlin 語法介紹
 
Karate - powerful and simple framework for REST API automation testing
Karate - powerful and simple framework for REST API automation testingKarate - powerful and simple framework for REST API automation testing
Karate - powerful and simple framework for REST API automation testing
 

Similar to Distributed load testing with k6

Distributed load testing with K6 - NDC London 2024
Distributed load testing with K6 - NDC London 2024Distributed load testing with K6 - NDC London 2024
Distributed load testing with K6 - NDC London 2024Thijs Feryn
 
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)Wesley Beary
 
fog or: How I Learned to Stop Worrying and Love the Cloud
fog or: How I Learned to Stop Worrying and Love the Cloudfog or: How I Learned to Stop Worrying and Love the Cloud
fog or: How I Learned to Stop Worrying and Love the CloudWesley Beary
 
Performance and stability testing \w Gatling
Performance and stability testing \w GatlingPerformance and stability testing \w Gatling
Performance and stability testing \w GatlingDmitry Vrublevsky
 
Bonnes pratiques de développement avec Node js
Bonnes pratiques de développement avec Node jsBonnes pratiques de développement avec Node js
Bonnes pratiques de développement avec Node jsFrancois Zaninotto
 
RestMQ - HTTP/Redis based Message Queue
RestMQ - HTTP/Redis based Message QueueRestMQ - HTTP/Redis based Message Queue
RestMQ - HTTP/Redis based Message QueueGleicon Moraes
 
Google App Engine Developer - Day3
Google App Engine Developer - Day3Google App Engine Developer - Day3
Google App Engine Developer - Day3Simon Su
 
Avoiding Callback Hell with Async.js
Avoiding Callback Hell with Async.jsAvoiding Callback Hell with Async.js
Avoiding Callback Hell with Async.jscacois
 
Load Testing with PHP and RedLine13
Load Testing with PHP and RedLine13Load Testing with PHP and RedLine13
Load Testing with PHP and RedLine13Jason Lotito
 
Hazelcast
HazelcastHazelcast
Hazelcastoztalip
 
"Load Testing Distributed Systems with NBomber 4.0", Anton Moldovan
"Load Testing Distributed Systems with NBomber 4.0",  Anton Moldovan"Load Testing Distributed Systems with NBomber 4.0",  Anton Moldovan
"Load Testing Distributed Systems with NBomber 4.0", Anton MoldovanFwdays
 
Oracle database - Get external data via HTTP, FTP and Web Services
Oracle database - Get external data via HTTP, FTP and Web ServicesOracle database - Get external data via HTTP, FTP and Web Services
Oracle database - Get external data via HTTP, FTP and Web ServicesKim Berg Hansen
 
Non-blocking I/O, Event loops and node.js
Non-blocking I/O, Event loops and node.jsNon-blocking I/O, Event loops and node.js
Non-blocking I/O, Event loops and node.jsMarcus Frödin
 
Fun Teaching MongoDB New Tricks
Fun Teaching MongoDB New TricksFun Teaching MongoDB New Tricks
Fun Teaching MongoDB New TricksMongoDB
 
Anton Moldovan "Load testing which you always wanted"
Anton Moldovan "Load testing which you always wanted"Anton Moldovan "Load testing which you always wanted"
Anton Moldovan "Load testing which you always wanted"Fwdays
 
QA Fest 2019. Saar Rachamim. Developing Tools, While Testing
QA Fest 2019. Saar Rachamim. Developing Tools, While TestingQA Fest 2019. Saar Rachamim. Developing Tools, While Testing
QA Fest 2019. Saar Rachamim. Developing Tools, While TestingQAFest
 

Similar to Distributed load testing with k6 (20)

Distributed load testing with K6 - NDC London 2024
Distributed load testing with K6 - NDC London 2024Distributed load testing with K6 - NDC London 2024
Distributed load testing with K6 - NDC London 2024
 
Server Side Swift: Vapor
Server Side Swift: VaporServer Side Swift: Vapor
Server Side Swift: Vapor
 
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)
 
fog or: How I Learned to Stop Worrying and Love the Cloud
fog or: How I Learned to Stop Worrying and Love the Cloudfog or: How I Learned to Stop Worrying and Love the Cloud
fog or: How I Learned to Stop Worrying and Love the Cloud
 
Performance and stability testing \w Gatling
Performance and stability testing \w GatlingPerformance and stability testing \w Gatling
Performance and stability testing \w Gatling
 
Bonnes pratiques de développement avec Node js
Bonnes pratiques de développement avec Node jsBonnes pratiques de développement avec Node js
Bonnes pratiques de développement avec Node js
 
Solr @ Etsy - Apache Lucene Eurocon
Solr @ Etsy - Apache Lucene EuroconSolr @ Etsy - Apache Lucene Eurocon
Solr @ Etsy - Apache Lucene Eurocon
 
RestMQ - HTTP/Redis based Message Queue
RestMQ - HTTP/Redis based Message QueueRestMQ - HTTP/Redis based Message Queue
RestMQ - HTTP/Redis based Message Queue
 
Google App Engine Developer - Day3
Google App Engine Developer - Day3Google App Engine Developer - Day3
Google App Engine Developer - Day3
 
Avoiding Callback Hell with Async.js
Avoiding Callback Hell with Async.jsAvoiding Callback Hell with Async.js
Avoiding Callback Hell with Async.js
 
Load Testing with PHP and RedLine13
Load Testing with PHP and RedLine13Load Testing with PHP and RedLine13
Load Testing with PHP and RedLine13
 
Hazelcast
HazelcastHazelcast
Hazelcast
 
"Load Testing Distributed Systems with NBomber 4.0", Anton Moldovan
"Load Testing Distributed Systems with NBomber 4.0",  Anton Moldovan"Load Testing Distributed Systems with NBomber 4.0",  Anton Moldovan
"Load Testing Distributed Systems with NBomber 4.0", Anton Moldovan
 
Oracle database - Get external data via HTTP, FTP and Web Services
Oracle database - Get external data via HTTP, FTP and Web ServicesOracle database - Get external data via HTTP, FTP and Web Services
Oracle database - Get external data via HTTP, FTP and Web Services
 
Non-blocking I/O, Event loops and node.js
Non-blocking I/O, Event loops and node.jsNon-blocking I/O, Event loops and node.js
Non-blocking I/O, Event loops and node.js
 
Postman On Steroids
Postman On SteroidsPostman On Steroids
Postman On Steroids
 
Fun Teaching MongoDB New Tricks
Fun Teaching MongoDB New TricksFun Teaching MongoDB New Tricks
Fun Teaching MongoDB New Tricks
 
Anton Moldovan "Load testing which you always wanted"
Anton Moldovan "Load testing which you always wanted"Anton Moldovan "Load testing which you always wanted"
Anton Moldovan "Load testing which you always wanted"
 
Aimaf
AimafAimaf
Aimaf
 
QA Fest 2019. Saar Rachamim. Developing Tools, While Testing
QA Fest 2019. Saar Rachamim. Developing Tools, While TestingQA Fest 2019. Saar Rachamim. Developing Tools, While Testing
QA Fest 2019. Saar Rachamim. Developing Tools, While Testing
 

More from Thijs Feryn

10 things that helped me advance my career - PHP UK Conference 2024
10 things that helped me advance my career - PHP UK Conference 202410 things that helped me advance my career - PHP UK Conference 2024
10 things that helped me advance my career - PHP UK Conference 2024Thijs Feryn
 
HTTP headers that make your website go faster - devs.gent November 2023
HTTP headers that make your website go faster - devs.gent November 2023HTTP headers that make your website go faster - devs.gent November 2023
HTTP headers that make your website go faster - devs.gent November 2023Thijs Feryn
 
Living on the edge - EBU Horizons 2023
Living on the edge - EBU Horizons 2023Living on the edge - EBU Horizons 2023
Living on the edge - EBU Horizons 2023Thijs Feryn
 
Core web vitals meten om je site sneller te maken - Combell Partner Day 2023
Core web vitals meten om je site sneller te maken - Combell Partner Day 2023Core web vitals meten om je site sneller te maken - Combell Partner Day 2023
Core web vitals meten om je site sneller te maken - Combell Partner Day 2023Thijs Feryn
 
HTTP headers that make your website go faster
HTTP headers that make your website go fasterHTTP headers that make your website go faster
HTTP headers that make your website go fasterThijs Feryn
 
HTTP headers that will make your website go faster
HTTP headers that will make your website go fasterHTTP headers that will make your website go faster
HTTP headers that will make your website go fasterThijs Feryn
 
HTTP logging met Varnishlog - PHPWVL 2022
HTTP logging met Varnishlog - PHPWVL 2022HTTP logging met Varnishlog - PHPWVL 2022
HTTP logging met Varnishlog - PHPWVL 2022Thijs Feryn
 
Taking Laravel to the edge with HTTP caching and Varnish
Taking Laravel to the edge with HTTP caching and VarnishTaking Laravel to the edge with HTTP caching and Varnish
Taking Laravel to the edge with HTTP caching and VarnishThijs Feryn
 
Build your own CDN with Varnish - Confoo 2022
Build your own CDN with Varnish - Confoo 2022Build your own CDN with Varnish - Confoo 2022
Build your own CDN with Varnish - Confoo 2022Thijs Feryn
 
Caching the uncacheable with Varnish - DevDays 2021
Caching the uncacheable with Varnish - DevDays 2021Caching the uncacheable with Varnish - DevDays 2021
Caching the uncacheable with Varnish - DevDays 2021Thijs Feryn
 
Developing cacheable backend applications - Appdevcon 2019
Developing cacheable backend applications - Appdevcon 2019Developing cacheable backend applications - Appdevcon 2019
Developing cacheable backend applications - Appdevcon 2019Thijs Feryn
 
How Cloud addresses the needs of todays internet - Korazon 2018
How Cloud addresses the needs of todays internet - Korazon 2018How Cloud addresses the needs of todays internet - Korazon 2018
How Cloud addresses the needs of todays internet - Korazon 2018Thijs Feryn
 
Developing cacheable PHP applications - PHPLimburgBE 2018
Developing cacheable PHP applications - PHPLimburgBE 2018Developing cacheable PHP applications - PHPLimburgBE 2018
Developing cacheable PHP applications - PHPLimburgBE 2018Thijs Feryn
 
Leverage HTTP to deliver cacheable websites - Codemotion Rome 2018
Leverage HTTP to deliver cacheable websites - Codemotion Rome 2018Leverage HTTP to deliver cacheable websites - Codemotion Rome 2018
Leverage HTTP to deliver cacheable websites - Codemotion Rome 2018Thijs Feryn
 
Developing cacheable PHP applications - Confoo 2018
Developing cacheable PHP applications - Confoo 2018Developing cacheable PHP applications - Confoo 2018
Developing cacheable PHP applications - Confoo 2018Thijs Feryn
 

More from Thijs Feryn (15)

10 things that helped me advance my career - PHP UK Conference 2024
10 things that helped me advance my career - PHP UK Conference 202410 things that helped me advance my career - PHP UK Conference 2024
10 things that helped me advance my career - PHP UK Conference 2024
 
HTTP headers that make your website go faster - devs.gent November 2023
HTTP headers that make your website go faster - devs.gent November 2023HTTP headers that make your website go faster - devs.gent November 2023
HTTP headers that make your website go faster - devs.gent November 2023
 
Living on the edge - EBU Horizons 2023
Living on the edge - EBU Horizons 2023Living on the edge - EBU Horizons 2023
Living on the edge - EBU Horizons 2023
 
Core web vitals meten om je site sneller te maken - Combell Partner Day 2023
Core web vitals meten om je site sneller te maken - Combell Partner Day 2023Core web vitals meten om je site sneller te maken - Combell Partner Day 2023
Core web vitals meten om je site sneller te maken - Combell Partner Day 2023
 
HTTP headers that make your website go faster
HTTP headers that make your website go fasterHTTP headers that make your website go faster
HTTP headers that make your website go faster
 
HTTP headers that will make your website go faster
HTTP headers that will make your website go fasterHTTP headers that will make your website go faster
HTTP headers that will make your website go faster
 
HTTP logging met Varnishlog - PHPWVL 2022
HTTP logging met Varnishlog - PHPWVL 2022HTTP logging met Varnishlog - PHPWVL 2022
HTTP logging met Varnishlog - PHPWVL 2022
 
Taking Laravel to the edge with HTTP caching and Varnish
Taking Laravel to the edge with HTTP caching and VarnishTaking Laravel to the edge with HTTP caching and Varnish
Taking Laravel to the edge with HTTP caching and Varnish
 
Build your own CDN with Varnish - Confoo 2022
Build your own CDN with Varnish - Confoo 2022Build your own CDN with Varnish - Confoo 2022
Build your own CDN with Varnish - Confoo 2022
 
Caching the uncacheable with Varnish - DevDays 2021
Caching the uncacheable with Varnish - DevDays 2021Caching the uncacheable with Varnish - DevDays 2021
Caching the uncacheable with Varnish - DevDays 2021
 
Developing cacheable backend applications - Appdevcon 2019
Developing cacheable backend applications - Appdevcon 2019Developing cacheable backend applications - Appdevcon 2019
Developing cacheable backend applications - Appdevcon 2019
 
How Cloud addresses the needs of todays internet - Korazon 2018
How Cloud addresses the needs of todays internet - Korazon 2018How Cloud addresses the needs of todays internet - Korazon 2018
How Cloud addresses the needs of todays internet - Korazon 2018
 
Developing cacheable PHP applications - PHPLimburgBE 2018
Developing cacheable PHP applications - PHPLimburgBE 2018Developing cacheable PHP applications - PHPLimburgBE 2018
Developing cacheable PHP applications - PHPLimburgBE 2018
 
Leverage HTTP to deliver cacheable websites - Codemotion Rome 2018
Leverage HTTP to deliver cacheable websites - Codemotion Rome 2018Leverage HTTP to deliver cacheable websites - Codemotion Rome 2018
Leverage HTTP to deliver cacheable websites - Codemotion Rome 2018
 
Developing cacheable PHP applications - Confoo 2018
Developing cacheable PHP applications - Confoo 2018Developing cacheable PHP applications - Confoo 2018
Developing cacheable PHP applications - Confoo 2018
 

Recently uploaded

Generative AI Use Cases and Applications.pdf
Generative AI Use Cases and Applications.pdfGenerative AI Use Cases and Applications.pdf
Generative AI Use Cases and Applications.pdfalexjohnson7307
 
2024 May Patch Tuesday
2024 May Patch Tuesday2024 May Patch Tuesday
2024 May Patch TuesdayIvanti
 
Google I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGoogle I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGDSC PJATK
 
Cyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptx
Cyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptxCyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptx
Cyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptxMasterG
 
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...ScyllaDB
 
AI mind or machine power point presentation
AI mind or machine power point presentationAI mind or machine power point presentation
AI mind or machine power point presentationyogeshlabana357357
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)Samir Dash
 
ADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptxADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptxFIDO Alliance
 
WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024Lorenzo Miniero
 
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdfMuhammad Subhan
 
Design Guidelines for Passkeys 2024.pptx
Design Guidelines for Passkeys 2024.pptxDesign Guidelines for Passkeys 2024.pptx
Design Guidelines for Passkeys 2024.pptxFIDO Alliance
 
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...FIDO Alliance
 
Frisco Automating Purchase Orders with MuleSoft IDP- May 10th, 2024.pptx.pdf
Frisco Automating Purchase Orders with MuleSoft IDP- May 10th, 2024.pptx.pdfFrisco Automating Purchase Orders with MuleSoft IDP- May 10th, 2024.pptx.pdf
Frisco Automating Purchase Orders with MuleSoft IDP- May 10th, 2024.pptx.pdfAnubhavMangla3
 
State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!Memoori
 
UiPath manufacturing technology benefits and AI overview
UiPath manufacturing technology benefits and AI overviewUiPath manufacturing technology benefits and AI overview
UiPath manufacturing technology benefits and AI overviewDianaGray10
 
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider  Progress from Awareness to Implementation.pptxTales from a Passkey Provider  Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider Progress from Awareness to Implementation.pptxFIDO Alliance
 
ERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage IntacctERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage IntacctBrainSell Technologies
 
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...ScyllaDB
 
Portal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russePortal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russe中 央社
 
WebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM PerformanceWebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM PerformanceSamy Fodil
 

Recently uploaded (20)

Generative AI Use Cases and Applications.pdf
Generative AI Use Cases and Applications.pdfGenerative AI Use Cases and Applications.pdf
Generative AI Use Cases and Applications.pdf
 
2024 May Patch Tuesday
2024 May Patch Tuesday2024 May Patch Tuesday
2024 May Patch Tuesday
 
Google I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGoogle I/O Extended 2024 Warsaw
Google I/O Extended 2024 Warsaw
 
Cyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptx
Cyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptxCyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptx
Cyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptx
 
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
 
AI mind or machine power point presentation
AI mind or machine power point presentationAI mind or machine power point presentation
AI mind or machine power point presentation
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
 
ADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptxADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptx
 
WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024
 
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf
 
Design Guidelines for Passkeys 2024.pptx
Design Guidelines for Passkeys 2024.pptxDesign Guidelines for Passkeys 2024.pptx
Design Guidelines for Passkeys 2024.pptx
 
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
 
Frisco Automating Purchase Orders with MuleSoft IDP- May 10th, 2024.pptx.pdf
Frisco Automating Purchase Orders with MuleSoft IDP- May 10th, 2024.pptx.pdfFrisco Automating Purchase Orders with MuleSoft IDP- May 10th, 2024.pptx.pdf
Frisco Automating Purchase Orders with MuleSoft IDP- May 10th, 2024.pptx.pdf
 
State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!
 
UiPath manufacturing technology benefits and AI overview
UiPath manufacturing technology benefits and AI overviewUiPath manufacturing technology benefits and AI overview
UiPath manufacturing technology benefits and AI overview
 
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider  Progress from Awareness to Implementation.pptxTales from a Passkey Provider  Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
 
ERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage IntacctERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage Intacct
 
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
 
Portal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russePortal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russe
 
WebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM PerformanceWebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM Performance
 

Distributed load testing with k6

  • 4.
  • 5.
  • 6. 10,000,000 WEBSITES 21% OF THE TOP 10K WEBSITES
  • 8.
  • 9.
  • 13.
  • 14. BY
  • 16. import http from 'k6/http'; import { sleep } from 'k6'; export default function () { http.get('https://test.k6.io'); sleep(1); }
  • 17. RUN PERFORMANCE TESTS ✓LOCALLY OPEN SOURCE ✓IN THE CLOUD COMMERCIAL PRODUCT ✓VIA KUBERNETES OPEN SOURCE
  • 18. $ k6 run script.js
  • 19. $ k6 cloud script.js
  • 20. --- apiVersion: k6.io/v1alpha1 kind: K6 metadata: name: k6-sample spec: parallelism: 4 script: configMap: name: k6-test file: test.js
  • 21. $ kubectl apply -f k6.yaml
  • 22. $ k6 run script.js FOCUS ON LOCAL EXECUTOR
  • 23. / |‾‾| /‾‾/ /‾‾/ / / | |/ / / / / / | ( / ‾‾ / | | | (‾) | / __________ |__| __ _____/ .io execution: local script: script.js output: - scenarios: (100.00%) 1 scenario, 1 max VUs, 10m30s max duration (incl. graceful stop): * default: 1 iterations for each of 1 VUs (maxDuration: 10m0s, gracefulStop: 30s) running (00m01.3s), 0/1 VUs, 1 complete and 0 interrupted iterations default ✓ [========================] 1 VUs 00m01.3s/10m0s 1/1 iters, 1 per VU data_received..................: 17 kB 13 kB/s data_sent......................: 438 B 334 B/s http_req_blocked...............: avg=204.96ms min=204.96ms med=204.96ms max=204.96ms p(90)=204.96ms p(95)=204.96ms http_req_connecting............: avg=97.58ms min=97.58ms med=97.58ms max=97.58ms p(90)=97.58ms p(95)=97.58ms http_req_duration..............: avg=105.05ms min=105.05ms med=105.05ms max=105.05ms p(90)=105.05ms p(95)=105.05ms { expected_response:true }...: avg=105.05ms min=105.05ms med=105.05ms max=105.05ms p(90)=105.05ms p(95)=105.05ms http_req_failed................: 0.00% ✓ 0 ✗ 1 http_req_receiving.............: avg=143µs min=143µs med=143µs max=143µs p(90)=143µs p(95)=143µs http_req_sending...............: avg=39µs min=39µs med=39µs max=39µs p(90)=39µs p(95)=39µs http_req_tls_handshaking.......: avg=106.12ms min=106.12ms med=106.12ms max=106.12ms p(90)=106.12ms p(95)=106.12ms http_req_waiting...............: avg=104.87ms min=104.87ms med=104.87ms max=104.87ms p(90)=104.87ms p(95)=104.87ms http_reqs......................: 1 0.762132/s iteration_duration.............: avg=1.31s min=1.31s med=1.31s max=1.31s p(90)=1.31s p(95)=1.31s iterations.....................: 1 0.762132/s vus............................: 1 min=1 max=1 vus_max........................: 1 min=1 max=1
  • 24. running (00m01.3s), 0/1 VUs, 1 complete and 0 interrupted iterations default ✓ [========================] 1 VUs 00m01.3s/10m0s 1/1 iters, 1 per VU data_received..................: 17 kB 13 kB/s data_sent......................: 438 B 334 B/s http_req_blocked...............: avg=204.96ms min=204.96ms med=204.96ms max=204.96ms p(90)=204.96ms p(95)=204.96ms http_req_connecting............: avg=97.58ms min=97.58ms med=97.58ms max=97.58ms p(90)=97.58ms p(95)=97.58ms http_req_duration..............: avg=105.05ms min=105.05ms med=105.05ms max=105.05ms p(90)=105.05ms p(95)=105.05ms { expected_response:true }...: avg=105.05ms min=105.05ms med=105.05ms max=105.05ms p(90)=105.05ms p(95)=105.05ms http_req_failed................: 0.00% ✓ 0 ✗ 1 http_req_receiving.............: avg=143µs min=143µs med=143µs max=143µs p(90)=143µs p(95)=143µs http_req_sending...............: avg=39µs min=39µs med=39µs max=39µs p(90)=39µs p(95)=39µs http_req_tls_handshaking.......: avg=106.12ms min=106.12ms med=106.12ms max=106.12ms p(90)=106.12ms p(95)=106.12ms http_req_waiting...............: avg=104.87ms min=104.87ms med=104.87ms max=104.87ms p(90)=104.87ms p(95)=104.87ms http_reqs......................: 1 0.762132/s iteration_duration.............: avg=1.31s min=1.31s med=1.31s max=1.31s p(90)=1.31s p(95)=1.31s iterations.....................: 1 0.762132/s vus............................: 1 min=1 max=1 vus_max........................: 1 min=1 max=1
  • 25. K6 CAPABILITIES ✓ CLI TOOLS ✓ SCRIPTING (JAVASCRIPT ES2015/ES6) ✓ MODULES ✓ CHECKS, THRESHOLDS & METRICS ✓ TEST SCENARIO & TEST EXECUTOR CUSTOMIZATION ✓ TEST BUILDER & BROWSER RECORDER ✓ RESULT STORAGE & VISUALIZATION INTEGRATIONS
  • 26. SCALING UP ⬆ THE TESTS
  • 27. $ k6 run -u 100 -d 1m script.js
  • 28. import http from 'k6/http'; import { sleep } from 'k6'; export const options = { vus: 100, duration: '1m', }; export default function () { http.get('https://test.k6.io'); sleep(1); }
  • 31. import http from 'k6/http'; export default function () { http.get('https://test.k6.io'); }
  • 32. import http from 'k6/http'; export default function () { for (let id = 1; id <= 100; id++) { http.get(`https://test.k6.io?id=${id}`); } }
  • 33. import http from 'k6/http'; export default function () { const params = { cookies: { lang: 'nl' }, headers: { 'Accept-Language': 'nl' } }; http.get('https://test.k6.io', params); }
  • 34. REQUEST PARAMETERS ✓ COOKIES & COOKIE JAR ✓ HEADERS ✓ AUTHENTICATION TYPE ✓ REDIRECTS ✓ TAGS ✓ TIMEOUT ✓ COMPRESSION
  • 35. import http from 'k6/http'; export default function () { let data = 'name=Thijs' ; http.post('https://httpbin.test.k6.io/post', data); }
  • 36. import http from 'k6/http'; export default function () { let data = { name: 'Thijs' }; http.post('https://httpbin.test.k6.io/post', JSON.stringify(data), { headers: { 'Content-Type': 'application/json' } }); }
  • 37. http.get(url, [params]); http.head(url, [params]); http.post(url, [body] [params]); http.delete(url, [body] [params]); http.patch(url, [body] [params]); http.put(url, [body] [params]); http.request(method, url, [body] [params]); http.batch(array | object);
  • 38. import http from 'k6/http'; import { check } from 'k6'; export default function () { const responses = http.batch([ ['GET', 'https://test.k6.io'], ['GET', 'https://test.k6.io/style.css'], ['GET', 'https://test.k6.io/images/logo.png'], ]); check(responses[0], { 'main page status was 200': (res) => res.status === 200, }); }
  • 40. import http from 'k6/http'; import { check } from 'k6'; export default function () { const res = http.get('http://httpbin.test.k6.io'); check(res, { 'response code was 200': (res) => res.status == 200, }); }
  • 42. BOOL check(val, sets, [tags]) CREATES A RATE METRIC FALSE ASSERTION DOESN'T STOP THE TEST RUN
  • 43. BOOL check(res, { 'response code was 200': (res) => res.status == 200, })
  • 44. / |‾‾| /‾‾/ /‾‾/ / / | |/ / / / / / | ( / ‾‾ / | | | (‾) | / __________ |__| __ _____/ .io execution: local script: script.js output: - scenarios: (100.00%) 1 scenario, 1 max VUs, 10m30s max duration (incl. graceful stop): * default: 1 iterations for each of 1 VUs (maxDuration: 10m0s, gracefulStop: 30s) running (00m00.6s), 0/1 VUs, 1 complete and 0 interrupted iterations default ✓ [======================================] 1 VUs 00m00.6s/10m0s 1/1 iters, 1 per VU ✓ response code was 200 checks.........................: 100.00% ✓ 1 ✗ 0 data_received..................: 16 kB 28 kB/s data_sent......................: 574 B 1.0 kB/s http_req_blocked...............: avg=173.28ms min=128.83ms med=173.28ms max=217.73ms p(90)=208.84ms p(95)=213.28ms http_req_connecting............: avg=101.13ms min=99.15ms med=101.13ms max=103.11ms p(90)=102.71ms p(95)=102.91ms http_req_duration..............: avg=104.05ms min=101.57ms med=104.05ms max=106.53ms p(90)=106.04ms p(95)=106.28ms { expected_response:true }...: avg=104.05ms min=101.57ms med=104.05ms max=106.53ms p(90)=106.04ms p(95)=106.28ms http_req_failed................: 0.00% ✓ 0 ✗ 2 http_req_receiving.............: avg=939µs min=176µs med=939µs max=1.7ms p(90)=1.54ms p(95)=1.62ms http_req_sending...............: avg=63.5µs min=33µs med=63.5µs max=94µs p(90)=87.9µs p(95)=90.95µs http_req_tls_handshaking.......: avg=56.71ms min=0s med=56.71ms max=113.42ms p(90)=102.08ms p(95)=107.75ms http_req_waiting...............: avg=103.05ms min=99.83ms med=103.05ms max=106.26ms p(90)=105.62ms p(95)=105.94ms http_reqs......................: 2 3.577114/s iteration_duration.............: avg=557.34ms min=557.34ms med=557.34ms max=557.34ms p(90)=557.34ms p(95)=557.34ms iterations.....................: 1 1.788557/s
  • 45. scenarios: (100.00%) 1 scenario, 1 max VUs, 10m30s max duration (incl. grace * default: 1 iterations for each of 1 VUs (maxDuration: 10m0s, grac running (00m00.6s), 0/1 VUs, 1 complete and 0 interrupted iterations default ✓ [======================================] 1 VUs 00m00.6s/10m0s 1/1 ✓ response code was 200 checks.........................: 100.00% ✓ 1 ✗ 0 data_received..................: 16 kB 28 kB/s data_sent......................: 574 B 1.0 kB/s http_req_blocked...............: avg=173.28ms min=128.83ms med=173.28ms m http_req_connecting............: avg=101.13ms min=99.15ms med=101.13ms m http_req_duration..............: avg=104.05ms min=101.57ms med=104.05ms m { expected_response:true }...: avg=104.05ms min=101.57ms med=104.05ms m http_req_failed................: 0.00% ✓ 0 ✗ 2 http_req_receiving.............: avg=939µs min=176µs med=939µs m http_req_sending...............: avg=63.5µs min=33µs med=63.5µs m http_req_tls_handshaking.......: avg=56.71ms min=0s med=56.71ms m http_req_waiting...............: avg=103.05ms min=99.83ms med=103.05ms m
  • 46. / |‾‾| /‾‾/ /‾‾/ / / | |/ / / / / / | ( / ‾‾ / | | | (‾) | / __________ |__| __ _____/ .io execution: local script: script.js output: - scenarios: (100.00%) 1 scenario, 1 max VUs, 10m30s max duration (incl. graceful stop): * default: 1 iterations for each of 1 VUs (maxDuration: 10m0s, gracefulStop: 30s) running (00m00.6s), 0/1 VUs, 1 complete and 0 interrupted iterations default ✓ [======================================] 1 VUs 00m00.6s/10m0s 1/1 iters, 1 per VU ✗ response code was 200 ↳ 0% — ✓ 0 / ✗ 1 checks.........................: 0.00% ✓ 0 ✗ 1 data_received..................: 16 kB 26 kB/s data_sent......................: 574 B 945 B/s http_req_blocked...............: avg=192.27ms min=148.54ms med=192.27ms max=236ms p(90)=227.26ms p(95)=231.63ms http_req_connecting............: avg=110.66ms min=110.02ms med=110.66ms max=111.31ms p(90)=111.18ms p(95)=111.25ms http_req_duration..............: avg=109.19ms min=108.21ms med=109.19ms max=110.16ms p(90)=109.97ms p(95)=110.06ms { expected_response:true }...: avg=109.19ms min=108.21ms med=109.19ms max=110.16ms p(90)=109.97ms p(95)=110.06ms http_req_failed................: 0.00% ✓ 0 ✗ 2 http_req_receiving.............: avg=1.11ms min=219µs med=1.11ms max=2ms p(90)=1.83ms p(95)=1.92ms http_req_sending...............: avg=107.5µs min=35µs med=107.5µs max=180µs p(90)=165.5µs p(95)=172.75µs http_req_tls_handshaking.......: avg=62.14ms min=0s med=62.14ms max=124.28ms p(90)=111.85ms p(95)=118.07ms http_req_waiting...............: avg=107.97ms min=107.82ms med=107.97ms max=108.12ms p(90)=108.09ms p(95)=108.1ms http_reqs......................: 2 3.293108/s iteration_duration.............: avg=605.47ms min=605.47ms med=605.47ms max=605.47ms p(90)=605.47ms p(95)=605.47ms iterations.....................: 1 1.646554/s
  • 47. running (00m00.6s), 0/1 VUs, 1 complete and 0 interrupted iterations default ✓ [======================================] 1 VUs 00m00.6s/10 ✗ response code was 200 ↳ 0% — ✓ 0 / ✗ 1 checks.........................: 0.00% ✓ 0 ✗ 1 data_received..................: 16 kB 26 kB/s data_sent......................: 574 B 945 B/s http_req_blocked...............: avg=192.27ms min=148.54ms med=1 http_req_connecting............: avg=110.66ms min=110.02ms med=1 http_req_duration..............: avg=109.19ms min=108.21ms med=1 { expected_response:true }...: avg=109.19ms min=108.21ms med=1 http_req_failed................: 0.00% ✓ 0 ✗ 2 http_req_receiving.............: avg=1.11ms min=219µs med=1 http_req_sending...............: avg=107.5µs min=35µs med=1
  • 49. import http from 'k6/http'; import { sleep } from 'k6'; export const options = { thresholds: { http_req_failed: ['rate<0.01'], http_req_duration: ['p(95)<200'], }, }; export default function () { http.get('https://test.k6.io'); sleep(1); }
  • 50. / |‾‾| /‾‾/ /‾‾/ / / | |/ / / / / / | ( / ‾‾ / | | | (‾) | / __________ |__| __ _____/ .io execution: local script: script.js output: - scenarios: (100.00%) 1 scenario, 1 max VUs, 10m30s max duration (incl. graceful stop): * default: 1 iterations for each of 1 VUs (maxDuration: 10m0s, gracefulStop: 30s) running (00m01.4s), 0/1 VUs, 1 complete and 0 interrupted iterations default ✓ [======================================] 1 VUs 00m01.4s/10m0s 1/1 iters, 1 per VU data_received..................: 17 kB 12 kB/s data_sent......................: 438 B 321 B/s http_req_blocked...............: avg=252.92ms min=252.92ms med=252.92ms max=252.92ms p(90)=252.92ms p(95)=252.92ms http_req_connecting............: avg=103.95ms min=103.95ms med=103.95ms max=103.95ms p(90)=103.95ms p(95)=103.95ms ✓ http_req_duration..............: avg=106.92ms min=106.92ms med=106.92ms max=106.92ms p(90)=106.92ms p(95)=106.92ms { expected_response:true }...: avg=106.92ms min=106.92ms med=106.92ms max=106.92ms p(90)=106.92ms p(95)=106.92ms ✓ http_req_failed................: 0.00% ✓ 0 ✗ 1 http_req_receiving.............: avg=205µs min=205µs med=205µs max=205µs p(90)=205µs p(95)=205µs http_req_sending...............: avg=40µs min=40µs med=40µs max=40µs p(90)=40µs p(95)=40µs http_req_tls_handshaking.......: avg=114.34ms min=114.34ms med=114.34ms max=114.34ms p(90)=114.34ms p(95)=114.34ms http_req_waiting...............: avg=106.67ms min=106.67ms med=106.67ms max=106.67ms p(90)=106.67ms p(95)=106.67ms http_reqs......................: 1 0.733336/s iteration_duration.............: avg=1.36s min=1.36s med=1.36s max=1.36s p(90)=1.36s p(95)=1.36s iterations.....................: 1 0.733336/s vus............................: 1 min=1 max=1 vus_max........................: 1 min=1 max=1
  • 51. running (00m01.4s), 0/1 VUs, 1 complete and 0 interrupted iterations default ✓ [======================================] 1 VUs 00m01.4s/10m0s 1/1 i data_received..................: 17 kB 12 kB/s data_sent......................: 438 B 321 B/s http_req_blocked...............: avg=252.92ms min=252.92ms med=252.92ms ma http_req_connecting............: avg=103.95ms min=103.95ms med=103.95ms ma ✓ http_req_duration..............: avg=106.92ms min=106.92ms med=106.92ms ma { expected_response:true }...: avg=106.92ms min=106.92ms med=106.92ms ma ✓ http_req_failed................: 0.00% ✓ 0 ✗ 1 http_req_receiving.............: avg=205µs min=205µs med=205µs ma http_req_sending...............: avg=40µs min=40µs med=40µs ma http_req_tls_handshaking.......: avg=114.34ms min=114.34ms med=114.34ms ma http_req_waiting...............: avg=106.67ms min=106.67ms med=106.67ms ma http_reqs......................: 1 0.733336/s iteration_duration.............: avg=1.36s min=1.36s med=1.36s ma iterations.....................: 1 0.733336/s vus............................: 1 min=1 max=1 vus_max........................: 1 min=1 max=1
  • 52. import http from 'k6/http'; import { sleep } from 'k6'; export const options = { thresholds: { http_req_failed: ['rate<0.01'], http_req_duration: ['p(95)<90'], }, }; export default function () { http.get('https://test.k6.io'); sleep(1); }
  • 53. / |‾‾| /‾‾/ /‾‾/ / / | |/ / / / / / | ( / ‾‾ / | | | (‾) | / __________ |__| __ _____/ .io execution: local script: script.js output: - scenarios: (100.00%) 1 scenario, 1 max VUs, 10m30s max duration (incl. graceful stop): * default: 1 iterations for each of 1 VUs (maxDuration: 10m0s, gracefulStop: 30s) running (00m01.3s), 0/1 VUs, 1 complete and 0 interrupted iterations default ✓ [======================================] 1 VUs 00m01.3s/10m0s 1/1 iters, 1 per VU data_received..................: 17 kB 13 kB/s data_sent......................: 438 B 327 B/s http_req_blocked...............: avg=226.19ms min=226.19ms med=226.19ms max=226.19ms p(90)=226.19ms p(95)=226.19ms http_req_connecting............: avg=106.05ms min=106.05ms med=106.05ms max=106.05ms p(90)=106.05ms p(95)=106.05ms ✗ http_req_duration..............: avg=111.29ms min=111.29ms med=111.29ms max=111.29ms p(90)=111.29ms p(95)=111.29ms { expected_response:true }...: avg=111.29ms min=111.29ms med=111.29ms max=111.29ms p(90)=111.29ms p(95)=111.29ms ✓ http_req_failed................: 0.00% ✓ 0 ✗ 1 http_req_receiving.............: avg=223µs min=223µs med=223µs max=223µs p(90)=223µs p(95)=223µs http_req_sending...............: avg=39µs min=39µs med=39µs max=39µs p(90)=39µs p(95)=39µs http_req_tls_handshaking.......: avg=119.04ms min=119.04ms med=119.04ms max=119.04ms p(90)=119.04ms p(95)=119.04ms http_req_waiting...............: avg=111.03ms min=111.03ms med=111.03ms max=111.03ms p(90)=111.03ms p(95)=111.03ms http_reqs......................: 1 0.746263/s iteration_duration.............: avg=1.33s min=1.33s med=1.33s max=1.33s p(90)=1.33s p(95)=1.33s iterations.....................: 1 0.746263/s vus............................: 1 min=1 max=1 vus_max........................: 1 min=1 max=1 ERRO[0001] some thresholds have failed
  • 54. running (00m01.3s), 0/1 VUs, 1 complete and 0 interrupted iterations default ✓ [======================================] 1 VUs 00m01.3s/10m0s 1/1 iters, data_received..................: 17 kB 13 kB/s data_sent......................: 438 B 327 B/s http_req_blocked...............: avg=226.19ms min=226.19ms med=226.19ms max=226 http_req_connecting............: avg=106.05ms min=106.05ms med=106.05ms max=106 ✗ http_req_duration..............: avg=111.29ms min=111.29ms med=111.29ms max=111 { expected_response:true }...: avg=111.29ms min=111.29ms med=111.29ms max=111 ✓ http_req_failed................: 0.00% ✓ 0 ✗ 1 http_req_receiving.............: avg=223µs min=223µs med=223µs max=223 http_req_sending...............: avg=39µs min=39µs med=39µs max=39µ http_req_tls_handshaking.......: avg=119.04ms min=119.04ms med=119.04ms max=119 http_req_waiting...............: avg=111.03ms min=111.03ms med=111.03ms max=111 http_reqs......................: 1 0.746263/s iteration_duration.............: avg=1.33s min=1.33s med=1.33s max=1.3 iterations.....................: 1 0.746263/s vus............................: 1 min=1 max=1 vus_max........................: 1 min=1 max=1 ERRO[0001] some thresholds have failed
  • 55. lete and 0 interrupted iterations ==============] 1 VUs 00m01.3s/10m0s 1/1 iters, 1 per VU .: 17 kB 13 kB/s .: 438 B 327 B/s .: avg=226.19ms min=226.19ms med=226.19ms max=226.19ms p(90)=226.19ms p(95)=226.19ms .: avg=106.05ms min=106.05ms med=106.05ms max=106.05ms p(90)=106.05ms p(95)=106.05ms .: avg=111.29ms min=111.29ms med=111.29ms max=111.29ms p(90)=111.29ms p(95)=111.29ms .: avg=111.29ms min=111.29ms med=111.29ms max=111.29ms p(90)=111.29ms p(95)=111.29ms .: 0.00% ✓ 0 ✗ 1 .: avg=223µs min=223µs med=223µs max=223µs p(90)=223µs p(95)=223µs .: avg=39µs min=39µs med=39µs max=39µs p(90)=39µs p(95)=39µs .: avg=119.04ms min=119.04ms med=119.04ms max=119.04ms p(90)=119.04ms p(95)=119.04ms .: avg=111.03ms min=111.03ms med=111.03ms max=111.03ms p(90)=111.03ms p(95)=111.03ms .: 1 0.746263/s .: avg=1.33s min=1.33s med=1.33s max=1.33s p(90)=1.33s p(95)=1.33s .: 1 0.746263/s .: 1 min=1 max=1 .: 1 min=1 max=1 led
  • 56. import http from 'k6/http'; import { sleep } from 'k6'; export const options = { thresholds: { http_req_duration: ['p(90) < 400', 'p(95) < 800', 'p(99.9) < 2000'] }, }; export default function () { http.get('https://test.k6.io'); sleep(1); }
  • 57. T A G S
  • 60. import http from 'k6/http'; import { sleep } from 'k6'; export default function () { http.get('https://test.k6.io', { tags: { location: "eu", }, } ); sleep(1); }
  • 61. import http from 'k6/http'; import { sleep } from 'k6'; export const options = { tags: { location: 'eu', }, }; export default function () { http.get('https://test.k6.io'); sleep(1); }
  • 62. $ k6 run script.js --tag location="eu"
  • 63. import http from 'k6/http'; import { sleep } from 'k6'; import exec from 'k6/execution'; export function setup () { var location = 'eu'; switch(exec.vu.tags['location']) { case 'us': case 'apac': case 'eu': location = exec.vu.tags['location']; } return {"location": location}; } export default function (data) { var res = http.get(`https://${data.location}.test.com/`); console.log(res.request.url); sleep(1); }
  • 64. import http from 'k6/http'; export const options = { thresholds: { 'http_req_duration': ['p(95)<500'], 'http_req_duration{location:eu}': ['p(95)<400'], 'http_req_duration{location:us}': ['p(95)<200'], }, }; export default function () { http.get('https://test.k6.io/'); } THRESHOLDS PER TAG
  • 66. import http from 'k6/http'; import { sleep } from 'k6'; import { group } from 'k6'; import { check } from 'k6'; export default function (data) { let res; group('get', function () { res = http.get('https://test.k6.io/contacts.php'); check(res, { 'is contacts status 200': (r) => r.status === 200, }); res = http.get('https://test.k6.io/news.php'); check(res, { 'is news status 200': (r) => r.status === 200, }); sleep(1); });
  • 67. group('post', function () { res = http.post('https://test.k6.io/flip_coin.php', 'bet=heads'); check(res, { 'is heads status 200': (r) => r.status === 200, }); res = http.post('https://test.k6.io/flip_coin.php', 'bet=tails'); check(res, { 'is tails status 200': (r) => r.status === 200, }); sleep(1); }); }
  • 68. group('post', function () { res = http.post('https://test.k6.io/flip_coin.php', 'bet=heads'); check(res, { 'is heads status 200': (r) => r.status === 200, }); res = http.post('https://test.k6.io/flip_coin.php', 'bet=tails'); check(res, { 'is tails status 200': (r) => r.status === 200, }); sleep(1); }); } GROUP NAME IS ADDED AS A TAG
  • 69. / |‾‾| /‾‾/ /‾‾/ / / | |/ / / / / / | ( / ‾‾ / | | | (‾) | / __________ |__| __ _____/ .io execution: local script: script.js output: - scenarios: (100.00%) 1 scenario, 1 max VUs, 10m30s max duration (incl. graceful stop): * default: 1 iterations for each of 1 VUs (maxDuration: 10m0s, gracefulStop: 30s) running (00m02.7s), 0/1 VUs, 1 complete and 0 interrupted iterations default [======================================] 1 VUs 00m02.7s/10m0s 1/1 iters, 1 per VU █ get ✓ is contacts status 200 ✓ is news status 200 █ post ✓ is heads status 200 ✓ is tails status 200 checks.........................: 100.00% ✓ 4 ✗ 0 data_received..................: 9.6 kB 3.6 kB/s data_sent......................: 836 B 309 B/s group_duration.................: avg=1.35s min=1.21s med=1.35s max=1.48s p(90)=1.45s p(95)=1.47s http_req_blocked...............: avg=65.78ms min=4µs med=6µs max=263.13ms p(90)=184.19ms p(95)=223.66ms http_req_connecting............: avg=26.74ms min=0s med=0s max=106.96ms p(90)=74.87ms p(95)=90.91ms http_req_duration..............: avg=108.23ms min=102.12ms med=109.73ms max=111.35ms p(90)=110.94ms p(95)=111.14ms { expected_response:true }...: avg=108.23ms min=102.12ms med=109.73ms max=111.35ms p(90)=110.94ms p(95)=111.14ms http_req_failed................: 0.00% ✓ 0 ✗ 4 http_req_receiving.............: avg=154.5µs min=88µs med=138.5µs max=253µs p(90)=221.8µs p(95)=237.4µs http_req_sending...............: avg=96.25µs min=19µs med=30.5µs max=305µs p(90)=224.3µs p(95)=264.64µs http_req_tls_handshaking.......: avg=29.42ms min=0s med=0s max=117.71ms p(90)=82.4ms p(95)=100.06ms http_req_waiting...............: avg=107.98ms min=101.93ms med=109.38ms max=111.24ms p(90)=110.69ms p(95)=110.96ms http_reqs......................: 4 1.479629/s iteration_duration.............: avg=2.7s min=2.7s med=2.7s max=2.7s p(90)=2.7s p(95)=2.7s iterations.....................: 1 0.369907/s vus............................: 1 min=1 max=1 vus_max........................: 1 min=1 max=1
  • 70. █ get ✓ is contacts status 200 ✓ is news status 200 █ post ✓ is heads status 200 ✓ is tails status 200 checks.........................: 100.00% ✓ 4 ✗ 0 data_received..................: 9.6 kB 3.6 kB/s data_sent......................: 836 B 309 B/s group_duration.................: avg=1.35s min=1.21s med=1.35s max=1.48s p(90)=1 http_req_blocked...............: avg=65.78ms min=4µs med=6µs max=263.13ms p(90)=1 http_req_connecting............: avg=26.74ms min=0s med=0s max=106.96ms p(90)=7 http_req_duration..............: avg=108.23ms min=102.12ms med=109.73ms max=111.35ms p(90)=1 { expected_response:true }...: avg=108.23ms min=102.12ms med=109.73ms max=111.35ms p(90)=1 http_req_failed................: 0.00% ✓ 0 ✗ 4 http_req_receiving.............: avg=154.5µs min=88µs med=138.5µs max=253µs p(90)=2 http_req_sending...............: avg=96.25µs min=19µs med=30.5µs max=305µs p(90)=2 http_req_tls_handshaking.......: avg=29.42ms min=0s med=0s max=117.71ms p(90)=8 http_req_waiting...............: avg=107.98ms min=101.93ms med=109.38ms max=111.24ms p(90)=1
  • 72. // 1. init code export function setup() { // 2. setup code } export default function (data) { // 3. VU code } export function teardown(data) { // 4. teardown code }
  • 73. // 1. init code export function setup() { // 2. setup code } export default function (data) { // 3. VU code } export function teardown(data) { // 4. teardown code } ONCER PER VU
  • 74. // 1. init code export function setup() { // 2. setup code } export default function (data) { // 3. VU code } export function teardown(data) { // 4. teardown code } ONCER PER VU ONCE
  • 75. // 1. init code export function setup() { // 2. setup code } export default function (data) { // 3. VU code } export function teardown(data) { // 4. teardown code } ONCER PER VU ONCE ONCE PER ITERATION
  • 76. // 1. init code export function setup() { // 2. setup code } export default function (data) { // 3. VU code } export function teardown(data) { // 4. teardown code } ONCE ONCER PER VU ONCE ONCE PER ITERATION
  • 77. // 1. init code import http from 'k6/http'; export function setup() { // 2. setup code const res = http.get('https://httpbin.test.k6.io/json'); return { 'slides': res.json().slideshow.slides} } export default function (data) { // 3. VU code data.slides.forEach((slide) => { const res = http.get(`https://httpbin.test.k6.io/anything/${slide.title}}`); }); } export function teardown(data) { // 4. teardown code console.log('Test finished, ' + data.slides.length + ' slides processed.'); }
  • 79. import http from 'k6/http'; export default function () { const res = http.get('http://httpbin.test.k6.io'); console.log('Response time was ' + String(res.timings.duration) + ' ms'); }
  • 80. import http from 'k6/http'; export default function () { const res = http.get('http://httpbin.test.k6.io'); console.log('Response time was ' + String(res.timings.duration) + ' ms'); }
  • 83. import http from 'k6/http'; import { Counter } from 'k6/metrics'; import { randomItem } from 'https://jslib.k6.io/k6-utils/1.2.0/index.js'; const res200 = new Counter('res200'); const res300 = new Counter('res300'); const res400 = new Counter('res400'); const res500 = new Counter('res500'); const statuses = [200, 300, 400, 500]; export default function () { let res, status; for (let id = 1; id <= 20; id++) { status = randomItem(statuses); res = http.get(`https://httpbin.test.k6.io/status/${status}`); if(res.status >= 200 && res.status < 300) { res200.add(1); } else if(res.status >= 300 && res.status < 400) { res300.add(1); } else if(res.status >= 400 && res.status < 500) { res400.add(1); } else if(res.status >= 500 && res.status < 600) { res500.add(1); } } }
  • 84. data_received..................: 10 kB 4.7 kB/s data_sent......................: 2.7 kB 1.2 kB/s http_req_blocked...............: avg=11.58ms min=1µs med=5.5µs max=231.65ms p(90)=9. http_req_connecting............: avg=4.81ms min=0s med=0s max=96.32ms p(90)=0s http_req_duration..............: avg=98.32ms min=93.82ms med=99.33ms max=101.34ms p(90)=10 { expected_response:true }...: avg=98.63ms min=94.89ms med=99.53ms max=101.34ms p(90)=10 http_req_failed................: 50.00% ✓ 10 ✗ 10 http_req_receiving.............: avg=113.95µs min=20µs med=95.5µs max=258µs p(90)=22 http_req_sending...............: avg=22.4µs min=8µs med=22µs max=47µs p(90)=31 http_req_tls_handshaking.......: avg=5.15ms min=0s med=0s max=103.18ms p(90)=0s http_req_waiting...............: avg=98.18ms min=93.71ms med=99.12ms max=101.1ms p(90)=10 http_reqs......................: 20 9.070484/s iteration_duration.............: avg=2.2s min=2.2s med=2.2s max=2.2s p(90)=2. iterations.....................: 1 0.453524/s res200.........................: 6 2.721145/s res300.........................: 4 1.814097/s res400.........................: 8 3.628194/s res500.........................: 2 0.907048/s vus............................: 1 min=1 max=1 vus_max........................: 1 min=1 max=1
  • 85. CUSTOM METRIC TYPES ✓COUNTER CUMULATIVE SUM OF VALUES ✓GAUGE MIN, MAX & LAST VALUE ✓RATE PERCENTAGE OF NON-ZERO VALUES ✓TREND MIN, MAX, AVERAGE & PERCENTILES
  • 86. END OF TEST METRICS
  • 87. / |‾‾| /‾‾/ /‾‾/ / / | |/ / / / / / | ( / ‾‾ / | | | (‾) | / __________ |__| __ _____/ .io execution: local script: script.js output: - scenarios: (100.00%) 1 scenario, 1 max VUs, 10m30s max duration (incl. graceful stop): * default: 1 iterations for each of 1 VUs (maxDuration: 10m0s, gracefulStop: 30s) running (00m01.3s), 0/1 VUs, 1 complete and 0 interrupted iterations default ✓ [========================] 1 VUs 00m01.3s/10m0s 1/1 iters, 1 per VU data_received..................: 17 kB 13 kB/s data_sent......................: 438 B 334 B/s http_req_blocked...............: avg=204.96ms min=204.96ms med=204.96ms max=204.96ms p(90)=204.96ms p(95)=204.96ms http_req_connecting............: avg=97.58ms min=97.58ms med=97.58ms max=97.58ms p(90)=97.58ms p(95)=97.58ms http_req_duration..............: avg=105.05ms min=105.05ms med=105.05ms max=105.05ms p(90)=105.05ms p(95)=105.05ms { expected_response:true }...: avg=105.05ms min=105.05ms med=105.05ms max=105.05ms p(90)=105.05ms p(95)=105.05ms http_req_failed................: 0.00% ✓ 0 ✗ 1 http_req_receiving.............: avg=143µs min=143µs med=143µs max=143µs p(90)=143µs p(95)=143µs http_req_sending...............: avg=39µs min=39µs med=39µs max=39µs p(90)=39µs p(95)=39µs http_req_tls_handshaking.......: avg=106.12ms min=106.12ms med=106.12ms max=106.12ms p(90)=106.12ms p(95)=106.12ms http_req_waiting...............: avg=104.87ms min=104.87ms med=104.87ms max=104.87ms p(90)=104.87ms p(95)=104.87ms http_reqs......................: 1 0.762132/s iteration_duration.............: avg=1.31s min=1.31s med=1.31s max=1.31s p(90)=1.31s p(95)=1.31s iterations.....................: 1 0.762132/s vus............................: 1 min=1 max=1 vus_max........................: 1 min=1 max=1 YOU KNOW THIS ONE
  • 88. import http from 'k6/http'; export const options = { summaryTrendStats: ['avg', 'min', 'max', 'count'], }; export default function () { http.get('https://test.k6.io/'); } REDUCE TRENDS
  • 89. / |‾‾| /‾‾/ /‾‾/ / / | |/ / / / / / | ( / ‾‾ / | | | (‾) | / __________ |__| __ _____/ .io execution: local script: script.js output: - scenarios: (100.00%) 1 scenario, 1 max VUs, 10m30s max duration (incl. graceful stop): * default: 1 iterations for each of 1 VUs (maxDuration: 10m0s, gracefulStop: 30s) running (00m00.4s), 0/1 VUs, 1 complete and 0 interrupted iterations default ✓ [======================================] 1 VUs 00m00.4s/10m0s 1/1 iters, 1 per VU data_received..................: 17 kB 47 kB/s data_sent......................: 438 B 1.2 kB/s http_req_blocked...............: avg=256.46ms min=256.46ms max=256.46ms http_req_connecting............: avg=104.35ms min=104.35ms max=104.35ms http_req_duration..............: avg=106ms min=106ms max=106ms { expected_response:true }...: avg=106ms min=106ms max=106ms http_req_failed................: 0.00% ✓ 0 ✗ 1 http_req_receiving.............: avg=1.1ms min=1.1ms max=1.1ms http_req_sending...............: avg=34µs min=34µs max=34µs http_req_tls_handshaking.......: avg=121.56ms min=121.56ms max=121.56ms http_req_waiting...............: avg=104.86ms min=104.86ms max=104.86ms http_reqs......................: 1 2.74597/s iteration_duration.............: avg=362.78ms min=362.78ms max=362.78ms iterations.....................: 1 2.74597/s
  • 90. $ k6 run --summary-trend- stats="avg,min,max" script.js
  • 91. $ k6 run --no-summary script.js
  • 92. $ k6 run --out json script.js $ k6 run --out json=k6.json script.js $ k6 run --out csv=k6.csv script.js
  • 94. RESULT STORES & VISUALIZATIONS ✓JSON ✓CSV ✓AMAZON CLOUDWATCH ✓INFLUXDB ✓NEW RELIC ✓STATSD ✓APACHE KAFKA ✓DATADOG ✓PROMETHEUS ✓CLOUD ✓GRAFANA CLOUD ✓NETDATA ✓TIMESCALEDB
  • 95.
  • 96. $ go install go.k6.io/xk6/cmd/xk6@latest $ ~/go/bin/xk6 build v0.36.0 --with github.com/ szkiba/xk6-prometheus@latest $ k6 run -o "prometheus=namespace=k6&port=9090" $ curl http://localhost:9090
  • 97. # HELP k6_data_received The amount of received data # TYPE k6_data_received counter k6_data_received 8.4039802e+07 # HELP k6_data_sent The amount of data sent # TYPE k6_data_sent counter k6_data_sent 803484 # HELP k6_http_req_blocked Time spent blocked before initiating the request # TYPE k6_http_req_blocked summary k6_http_req_blocked{quantile="0.5"} 0.001541 k6_http_req_blocked{quantile="0.9"} 0.003791 k6_http_req_blocked{quantile="0.95"} 0.012 k6_http_req_blocked{quantile="1"} 1096.216625 k6_http_req_blocked_sum 154652.24431000135 k6_http_req_blocked_count 7432 # HELP k6_http_req_blocked_current Time spent blocked before initiating the request (current) # TYPE k6_http_req_blocked_current gauge k6_http_req_blocked_current 0.001667 # HELP k6_http_req_connecting Time spent establishing TCP connection # TYPE k6_http_req_connecting summary k6_http_req_connecting{quantile="0.5"} 0 k6_http_req_connecting{quantile="0.9"} 0 k6_http_req_connecting{quantile="0.95"} 0 k6_http_req_connecting{quantile="1"} 138.566084 k6_http_req_connecting_sum 36255.94142099999 k6_http_req_connecting_count 7432 PROMETHEUS OUTPUT
  • 98. # HELP k6_http_req_receiving_current Time spent receiving response data (current) # TYPE k6_http_req_receiving_current gauge k6_http_req_receiving_current 0.029083 # HELP k6_http_req_sending Time spent sending data # TYPE k6_http_req_sending summary k6_http_req_sending{quantile="0.5"} 0.006375 k6_http_req_sending{quantile="0.9"} 0.016209 k6_http_req_sending{quantile="0.95"} 0.024875 k6_http_req_sending{quantile="1"} 0.618167 k6_http_req_sending_sum 76.60019499999983 k6_http_req_sending_count 7432 # HELP k6_http_req_sending_current Time spent sending data (current) # TYPE k6_http_req_sending_current gauge k6_http_req_sending_current 0.008167 # HELP k6_http_req_tls_handshaking Time spent handshaking TLS session # TYPE k6_http_req_tls_handshaking summary k6_http_req_tls_handshaking{quantile="0.5"} 0 k6_http_req_tls_handshaking{quantile="0.9"} 0 k6_http_req_tls_handshaking{quantile="0.95"} 0 k6_http_req_tls_handshaking{quantile="1"} 933.331792 k6_http_req_tls_handshaking_sum 108611.02479299998 k6_http_req_tls_handshaking_count 7432 # HELP k6_http_req_tls_handshaking_current Time spent handshaking TLS session (current) # TYPE k6_http_req_tls_handshaking_current gauge k6_http_req_tls_handshaking_current 0 # HELP k6_http_req_waiting Time spent waiting for response # TYPE k6_http_req_waiting summary k6_http_req_waiting{quantile="0.5"} 100.567167
  • 99.
  • 100. $ k6 run hls.js -o "prometheus=namespace=k6&port=9090" $ k6 run hls.js -o "prometheus=namespace=k6&port=9090" $ k6 run hls.js -o "prometheus=namespace=k6&port=9090"
  • 101. global: scrape_interval: 5s scrape_timeout: 5s evaluation_interval: 10s scrape_configs: - job_name: k6-dublin static_configs: - targets: ['k6-dublin.test.com:9090'] labels: location: 'ir' - job_name: k6-california static_configs: - targets: ['k6-california.test.com:9090'] labels: location: 'us' - job_name: k6-singapore static_configs: - targets: ['k6-singapore.test.com:9090'] labels: location: 'sg'
  • 102. k6_http_req_duration{location="ir", quantile="0.5"} 3.243162 k6_http_req_duration{location="ir", quantile="0.9"} 66.362954 k6_http_req_duration{location="ir", quantile="0.95"} 75.922755 k6_http_req_duration{location="ir", quantile="1"} 174.131426 k6_http_req_duration{location="us", quantile="0.5"} 3.987286 k6_http_req_duration{location="us", quantile="0.9"} 59.605656 k6_http_req_duration{location="us", quantile="0.95"} 75.764216 k6_http_req_duration{location="us", quantile="1"} 127.388737 LABELS
  • 103.
  • 106. $ k6 run script.js -a :6565 -o "prometheus=namespace=k6&port=9090" --paused $ k6 run script.js -a :6565 -o "prometheus=namespace=k6&port=9090" --paused $ k6 run script.js -a :6565 -o "prometheus=namespace=k6&port=9090" --paused
  • 107. import http from 'k6/http'; export const options = { scenarios: { contacts: { executor: 'externally-controlled', vus: 2, maxVUs: 5000, duration: '2h', }, }, } export default function (data) { const res = http.get('https://test.k6.io/'); }
  • 108. $ k6 resume -a ireland.test.com:6565 status: 4 paused: "false" vus: "0" vus-max: "5000" stopped: false running: false tainted: false $ k6 scale -u 100 -a ireland.test.com:6565 status: 7 paused: "false" vus: "100" vus-max: "5000" stopped: false running: true tainted: false
  • 109. $ k6 resume -a us.test.com:6565 status: 4 paused: "false" vus: "0" vus-max: "5000" stopped: false running: false tainted: false $ k6 scale -u 100 -a us.test.com:6565 status: 7 paused: "false" vus: "100" vus-max: "5000" stopped: false running: true tainted: false
  • 110. $ k6 resume -a singapore.test.com:6565 status: 4 paused: "false" vus: "0" vus-max: "5000" stopped: false running: false tainted: false $ k6 scale -u 100 -a singapore.test.com:6565 status: 7 paused: "false" vus: "100" vus-max: "5000" stopped: false running: true tainted: false
  • 111. $ curl -X GET http://ireland.test.com:6565/v1/status {"data":{"type":"status","id":"default","attributes": {"status":7,"paused":false,"vus":100,"vus- max":5000,"stopped":false,"running":true,"tainted":false}}}
  • 112. $ curl -X PATCH http://california.test.com:6565/v1/status -H 'Content-Type: application/json' -d '{ "data": { "attributes": { "vus": 500 } } }' {"data":{"type":"status","id":"default","attributes": {"status":7,"paused":false,"vus":500,"vus- max":5000,"stopped":false,"running":true,"tainted":false}}}
  • 113. $ curl -X GET http://ireland.test.com:6565/v1/metrics/http_req_duration {"data": {"type":"metrics","id":"http_req_duration","attributes": {"type":"trend","contains":"time","tainted":null,"sample": {"avg":108.10542307692306,"max":116.119,"med":107.834,"min":1 02.749,"p(90)":111.269,"p(95)":113.75349999999999}}}}
  • 117. EXECUTORS ✓ SHARED ITERATIONS ✓ PER VU ITERATIONS ✓ CONSTANT VUS ✓ RAMPING VUS ✓ CONSTANT ARRIVAL RATE ✓ RAMPING ARRIVAL RATE ✓ EXTERNALLY CONTROLLED
  • 118. import http from 'k6/http'; import { sleep } from 'k6'; export const options = { discardResponseBodies: true, scenarios: { contacts: { executor: 'shared-iterations', vus: 10, iterations: 200, maxDuration: '30s', }, }, }; export default function () { http.get('https://test.k6.io/contacts.php'); sleep(0.5); }
  • 119.
  • 120. import http from 'k6/http'; import { sleep } from 'k6'; export const options = { discardResponseBodies: true, scenarios: { contacts: { executor: 'per-vu-iterations', vus: 10, iterations: 20, maxDuration: '30s', }, }, }; export default function () { http.get('https://test.k6.io/contacts.php'); sleep(0.5); }
  • 122. import http from 'k6/http'; import { sleep } from 'k6'; export const options = { discardResponseBodies: true, scenarios: { contacts: { executor: 'constant-vus', vus: 10, duration: '30s', }, }, }; export default function () { http.get('https://test.k6.io/contacts.php'); sleep(0.5); }
  • 124. import http from 'k6/http'; import { sleep } from 'k6'; export const options = { discardResponseBodies: true, scenarios: { contacts: { executor: 'ramping-vus', startVUs: 0, stages: [ { duration: '20s', target: 10 }, { duration: '10s', target: 0 }, ], gracefulRampDown: '0s', }, }, }; export default function () { http.get('https://test.k6.io/contacts.php'); sleep(0.5); }
  • 125.
  • 126. import http from 'k6/http'; import { sleep } from 'k6'; export const options = { discardResponseBodies: true, scenarios: { contacts: { executor: 'constant-arrival-rate', duration: '30s', rate: 30, timeUnit: '1s', preAllocatedVUs: 2, maxVUs: 50, }, }, }; export default function () { http.get('https://test.k6.io/contacts.php'); sleep(0.5); }
  • 128. import http from 'k6/http'; export const options = { discardResponseBodies: true, scenarios: { contacts: { executor: 'externally-controlled', vus: 10, maxVUs: 50, duration: '10m', }, }, }; export default function () { http.get('https://test.k6.io/contacts.php'); }