Skip to content

Instantly share code, notes, and snippets.

@virtcoder
Last active August 7, 2021 18:18
Show Gist options
  • Save virtcoder/291614c211787569b9230df1b5925dd8 to your computer and use it in GitHub Desktop.
Save virtcoder/291614c211787569b9230df1b5925dd8 to your computer and use it in GitHub Desktop.
K6 stress tests
/\ |‾‾| /‾‾/ /‾‾/
/\ / \ | |/ / / /
/ \/ \ | ( / ‾‾\
/ \ | |\ \ | (‾) |
/ __________ \ |__| \__\ \_____/ .io
execution: local
script: stressTest/get.js
output: -
scenarios: (100.00%) 1 scenario, 300 max VUs, 1m0s max duration (incl. graceful stop):
* constant_request_rate: 100.00 iterations/s for 30s (maxVUs: 100-300, gracefulStop: 30s)
running (0m30.0s), 000/100 VUs, 3002 complete and 0 interrupted iterations
constant_request_rate ✓ [======================================] 000/100 VUs 30s 100 iters/s
✓ response status 200
checks.........................: 100.00% ✓ 3002 ✗ 0
data_received..................: 898 kB 30 kB/s
data_sent......................: 318 kB 11 kB/s
http_req_blocked...............: avg=56.42µs min=0s med=0s max=33.56ms p(90)=0s p(95)=0s
http_req_connecting............: avg=49.13µs min=0s med=0s max=32.56ms p(90)=0s p(95)=0s
http_req_duration..............: avg=2.98ms min=505µs med=1.61ms max=281.98ms p(90)=2.81ms p(95)=3.37ms
{ expected_response:true }...: avg=2.98ms min=505µs med=1.61ms max=281.98ms p(90)=2.81ms p(95)=3.37ms
http_req_failed................: 0.00% ✓ 0 ✗ 3002
http_req_receiving.............: avg=127.53µs min=0s med=0s max=12.59ms p(90)=544.07µs p(95)=1ms
http_req_sending...............: avg=11.3µs min=0s med=0s max=1.52ms p(90)=0s p(95)=0s
http_req_tls_handshaking.......: avg=0s min=0s med=0s max=0s p(90)=0s p(95)=0s
http_req_waiting...............: avg=2.84ms min=504.8µs med=1.52ms max=281.98ms p(90)=2.64ms p(95)=3.23ms
http_reqs......................: 3002 100.007688/s
iteration_duration.............: avg=3.42ms min=506.2µs med=1.99ms max=285.44ms p(90)=3.25ms p(95)=3.89ms
iterations.....................: 3002 100.007688/s
vus............................: 100 min=100 max=100
vus_max........................: 100 min=100 max=100
/\ |‾‾| /‾‾/ /‾‾/
/\ / \ | |/ / / /
/ \/ \ | ( / ‾‾\
/ \ | |\ \ | (‾) |
/ __________ \ |__| \__\ \_____/ .io
execution: local
script: stressTest/get.js
output: -
scenarios: (100.00%) 1 scenario, 300 max VUs, 1m0s max duration (incl. graceful stop):
* constant_request_rate: 1000.00 iterations/s for 30s (maxVUs: 100-300, gracefulStop: 30s)
running (0m30.2s), 000/222 VUs, 29472 complete and 0 interrupted iterations
constant_request_rate ✓ [======================================] 000/222 VUs 30s 1000 iters/s
✓ response status 200
checks.........................: 100.00% ✓ 29472 ✗ 0
data_received..................: 8.8 MB 292 kB/s
data_sent......................: 3.1 MB 104 kB/s
dropped_iterations.............: 521 17.275887/s
http_req_blocked...............: avg=60.59µs min=0s med=0s max=124.37ms p(90)=0s p(95)=0s
http_req_connecting............: avg=48.06µs min=0s med=0s max=124.37ms p(90)=0s p(95)=0s
http_req_duration..............: avg=17.98ms min=0s med=1.6ms max=462.71ms p(90)=14.46ms p(95)=188.57ms
{ expected_response:true }...: avg=17.98ms min=0s med=1.6ms max=462.71ms p(90)=14.46ms p(95)=188.57ms
http_req_failed................: 0.00% ✓ 0 ✗ 29472
http_req_receiving.............: avg=86.96µs min=0s med=0s max=35ms p(90)=509µs p(95)=546.1µs
http_req_sending...............: avg=25.93µs min=0s med=0s max=122.37ms p(90)=0s p(95)=0s
http_req_tls_handshaking.......: avg=0s min=0s med=0s max=0s p(90)=0s p(95)=0s
http_req_waiting...............: avg=17.87ms min=0s med=1.45ms max=429.61ms p(90)=14.32ms p(95)=188.5ms
http_reqs......................: 29472 977.264744/s
iteration_duration.............: avg=18.27ms min=0s med=1.76ms max=464.58ms p(90)=14.76ms p(95)=188.83ms
iterations.....................: 29472 977.264744/s
vus............................: 222 min=182 max=222
vus_max........................: 222 min=182 max=222
/\ |‾‾| /‾‾/ /‾‾/
/\ / \ | |/ / / /
/ \/ \ | ( / ‾‾\
/ \ | |\ \ | (‾) |
/ __________ \ |__| \__\ \_____/ .io
execution: local
script: stressTest/get.js
output: -
scenarios: (100.00%) 1 scenario, 300 max VUs, 1m0s max duration (incl. graceful stop):
* constant_request_rate: 10000.00 iterations/s for 30s (maxVUs: 100-300, gracefulStop: 30s)
WARN[0001] Insufficient VUs, reached 300 active VUs and cannot initialize more executor=constant-arrival-rate scenario=constant_request_rate
running (0m30.2s), 000/300 VUs, 38490 complete and 0 interrupted iterations
constant_request_rate ✓ [======================================] 000/300 VUs 30s 10000 iters/s
✓ response status 200
checks.........................: 100.00% ✓ 38490 ✗ 0
data_received..................: 12 MB 381 kB/s
data_sent......................: 4.1 MB 135 kB/s
dropped_iterations.............: 261514 8665.598729/s
http_req_blocked...............: avg=23.38µs min=0s med=0s max=26.1ms p(90)=0s p(95)=0s
http_req_connecting............: avg=16.28µs min=0s med=0s max=25.11ms p(90)=0s p(95)=0s
http_req_duration..............: avg=230.73ms min=44.26ms med=223.51ms max=384.58ms p(90)=277.45ms p(95)=290.21ms
{ expected_response:true }...: avg=230.73ms min=44.26ms med=223.51ms max=384.58ms p(90)=277.45ms p(95)=290.21ms
http_req_failed................: 0.00% ✓ 0 ✗ 38490
http_req_receiving.............: avg=88.59µs min=0s med=0s max=10.23ms p(90)=0s p(95)=999.4µs
http_req_sending...............: avg=9.81µs min=0s med=0s max=6ms p(90)=0s p(95)=0s
http_req_tls_handshaking.......: avg=0s min=0s med=0s max=0s p(90)=0s p(95)=0s
http_req_waiting...............: avg=230.63ms min=44.26ms med=223.4ms max=384.58ms p(90)=277.31ms p(95)=290.19ms
http_reqs......................: 38490 1275.415064/s
iteration_duration.............: avg=230.88ms min=51.79ms med=223.64ms max=385.57ms p(90)=277.69ms p(95)=290.3ms
iterations.....................: 38490 1275.415064/s
vus............................: 300 min=300 max=300
vus_max........................: 300 min=300 max=300
import http from 'k6/http';
import { check } from 'k6';
export let options = {
scenarios: {
constant_request_rate: {
executor: "constant-arrival-rate",
rate: 10000,
timeUnit: "1s",
duration: "30s",
preAllocatedVUs: 100,
maxVUs: 300,
},
}
};
export default function () {
const testUrl = 'http://localhost:4095/author?authorId=9123456';
const response = http.get(testUrl);
check(response, {
'response status 200': (r) => r.status === 200,
});
}
/\ |‾‾| /‾‾/ /‾‾/
/\ / \ | |/ / / /
/ \/ \ | ( / ‾‾\
/ \ | |\ \ | (‾) |
/ __________ \ |__| \__\ \_____/ .io
execution: local
script: stressTest/update.js
output: -
scenarios: (100.00%) 1 scenario, 300 max VUs, 1m0s max duration (incl. graceful stop):
* constant_request_rate: 100.00 iterations/s for 30s (maxVUs: 100-300, gracefulStop: 30s)
running (0m30.0s), 000/100 VUs, 3001 complete and 0 interrupted iterations
constant_request_rate ✓ [======================================] 000/100 VUs 30s 100 iters/s
✓ response status 201
checks.........................: 100.00% ✓ 3001 ✗ 0
data_received..................: 1.5 MB 50 kB/s
data_sent......................: 968 kB 32 kB/s
http_req_blocked...............: avg=43.21µs min=0s med=0s max=7.41ms p(90)=0s p(95)=0s
http_req_connecting............: avg=30.76µs min=0s med=0s max=6.41ms p(90)=0s p(95)=0s
http_req_duration..............: avg=3.31ms min=504.7µs med=2.18ms max=242.72ms p(90)=3.9ms p(95)=4.78ms
{ expected_response:true }...: avg=3.31ms min=504.7µs med=2.18ms max=242.72ms p(90)=3.9ms p(95)=4.78ms
http_req_failed................: 0.00% ✓ 0 ✗ 3001
http_req_receiving.............: avg=133.76µs min=0s med=0s max=32.58ms p(90)=544.5µs p(95)=998.3µs
http_req_sending...............: avg=21.09µs min=0s med=0s max=1.02ms p(90)=0s p(95)=0s
http_req_tls_handshaking.......: avg=0s min=0s med=0s max=0s p(90)=0s p(95)=0s
http_req_waiting...............: avg=3.15ms min=504.7µs med=2.08ms max=242.72ms p(90)=3.65ms p(95)=4.51ms
http_reqs......................: 3001 100.018463/s
iteration_duration.............: avg=3.89ms min=999.4µs med=2.61ms max=244.89ms p(90)=4.4ms p(95)=5.48ms
iterations.....................: 3001 100.018463/s
vus............................: 100 min=100 max=100
vus_max........................: 100 min=100 max=100
/\ |‾‾| /‾‾/ /‾‾/
/\ / \ | |/ / / /
/ \/ \ | ( / ‾‾\
/ \ | |\ \ | (‾) |
/ __________ \ |__| \__\ \_____/ .io
execution: local
script: stressTest/update.js
output: -
scenarios: (100.00%) 1 scenario, 300 max VUs, 1m0s max duration (incl. graceful stop):
* constant_request_rate: 1000.00 iterations/s for 30s (maxVUs: 100-300, gracefulStop: 30s)
WARN[0002] Insufficient VUs, reached 300 active VUs and cannot initialize more executor=constant-arrival-rate scenario=constant_request_rate
running (0m30.2s), 000/300 VUs, 23679 complete and 0 interrupted iterations
constant_request_rate ✓ [======================================] 000/300 VUs 30s 1000 iters/s
✓ response status 201
checks.........................: 100.00% ✓ 23679 ✗ 0
data_received..................: 12 MB 390 kB/s
data_sent......................: 7.6 MB 253 kB/s
dropped_iterations.............: 6322 209.453043/s
http_req_blocked...............: avg=31.3µs min=0s med=0s max=45.7ms p(90)=0s p(95)=0s
http_req_connecting............: avg=21.58µs min=0s med=0s max=43.92ms p(90)=0s p(95)=0s
http_req_duration..............: avg=352.51ms min=157.08ms med=323.43ms max=1s p(90)=535.22ms p(95)=574.55ms
{ expected_response:true }...: avg=352.51ms min=157.08ms med=323.43ms max=1s p(90)=535.22ms p(95)=574.55ms
http_req_failed................: 0.00% ✓ 0 ✗ 23679
http_req_receiving.............: avg=112.44µs min=0s med=0s max=10.08ms p(90)=533.22µs p(95)=551.5µs
http_req_sending...............: avg=32.28µs min=0s med=0s max=12.69ms p(90)=0s p(95)=117.3µs
http_req_tls_handshaking.......: avg=0s min=0s med=0s max=0s p(90)=0s p(95)=0s
http_req_waiting...............: avg=352.37ms min=157.08ms med=323.35ms max=1s p(90)=534.9ms p(95)=574.37ms
http_reqs......................: 23679 784.504684/s
iteration_duration.............: avg=352.88ms min=157.83ms med=323.79ms max=1s p(90)=535.67ms p(95)=575.14ms
iterations.....................: 23679 784.504684/s
vus............................: 300 min=236 max=300
vus_max........................: 300 min=236 max=300
/\ |‾‾| /‾‾/ /‾‾/
/\ / \ | |/ / / /
/ \/ \ | ( / ‾‾\
/ \ | |\ \ | (‾) |
/ __________ \ |__| \__\ \_____/ .io
execution: local
script: stressTest/update.js
output: -
scenarios: (100.00%) 1 scenario, 300 max VUs, 1m0s max duration (incl. graceful stop):
* constant_request_rate: 10000.00 iterations/s for 30s (maxVUs: 100-300, gracefulStop: 30s)
WARN[0001] Insufficient VUs, reached 300 active VUs and cannot initialize more executor=constant-arrival-rate scenario=constant_request_rate
running (0m30.2s), 000/300 VUs, 26266 complete and 0 interrupted iterations
constant_request_rate ✓ [======================================] 000/300 VUs 30s 10000 iters/s
✓ response status 201
checks.........................: 100.00% ✓ 26266 ✗ 0
data_received..................: 13 MB 431 kB/s
data_sent......................: 8.5 MB 280 kB/s
dropped_iterations.............: 273764 9050.735558/s
http_req_blocked...............: avg=41.32µs min=0s med=0s max=28.18ms p(90)=0s p(95)=0s
http_req_connecting............: avg=31.78µs min=0s med=0s max=26.95ms p(90)=0s p(95)=0s
http_req_duration..............: avg=338.69ms min=242.58ms med=325.56ms max=775.33ms p(90)=393.5ms p(95)=428.34ms
{ expected_response:true }...: avg=338.69ms min=242.58ms med=325.56ms max=775.33ms p(90)=393.5ms p(95)=428.34ms
http_req_failed................: 0.00% ✓ 0 ✗ 26266
http_req_receiving.............: avg=96.83µs min=0s med=0s max=10.01ms p(90)=155.44µs p(95)=999.8µs
http_req_sending...............: avg=21.48µs min=0s med=0s max=13ms p(90)=0s p(95)=0s
http_req_tls_handshaking.......: avg=0s min=0s med=0s max=0s p(90)=0s p(95)=0s
http_req_waiting...............: avg=338.57ms min=242.04ms med=325.5ms max=775.33ms p(90)=393.15ms p(95)=428.12ms
http_reqs......................: 26266 868.363335/s
iteration_duration.............: avg=338.94ms min=242.58ms med=325.83ms max=782.52ms p(90)=393.68ms p(95)=428.73ms
iterations.....................: 26266 868.363335/s
vus............................: 300 min=300 max=300
vus_max........................: 300 min=300 max=300
import http from 'k6/http';
import { check } from 'k6';
const { generateAuthor } = require('./authorGen.js');
export let options = {
scenarios: {
constant_request_rate: {
executor: "constant-arrival-rate",
rate: 10000,
timeUnit: "1s",
duration: "30s",
preAllocatedVUs: 100,
maxVUs: 300,
},
}
}
export default function () {
const testUrl = 'http://localhost:4095/author';
const author = JSON.stringify(generateAuthor());
const response = http.post(testUrl, author, { headers: { 'Content-Type': 'application/json' } });
check(response, {
'response status 201': (r) => r.status === 201,
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment