Skip to content

Instantly share code, notes, and snippets.

@virtcoder
Created August 7, 2021 18:31
Show Gist options
  • Save virtcoder/a60521a10ef3d153794c52044af74a0a to your computer and use it in GitHub Desktop.
Save virtcoder/a60521a10ef3d153794c52044af74a0a to your computer and use it in GitHub Desktop.
K6 Stress Test
/\ |‾‾| /‾‾/ /‾‾/
/\ / \ | |/ / / /
/ \/ \ | ( / ‾‾\
/ \ | |\ \ | (‾) |
/ __________ \ |__| \__\ \_____/ .io
execution: local
script: stressTest/get.js
output: -
scenarios: (100.00%) 1 scenario, 300 max VUs, 2m30s max duration (incl. graceful stop):
* constant_request_rate: 100.00 iterations/s for 2m0s (maxVUs: 100-300, gracefulStop: 30s)
running (2m00.0s), 000/100 VUs, 12001 complete and 0 interrupted iterations
import http from 'k6/http';
constant_request_rate ✓ [======================================] 000/100 VUs 2m0s 100 iters/s
✓ response status 200
checks.........................: 100.00% ✓ 12001 ✗ 0
data_received..................: 7.2 MB 60 kB/s
data_sent......................: 1.2 MB 10 kB/s
http_req_blocked...............: avg=8.24µs min=4.37µs med=5.27µs max=7.8ms p(90)=5.97µs p(95)=7.99µs
http_req_connecting............: avg=2.32µs min=0s med=0s max=7.75ms p(90)=0s p(95)=0s
http_req_duration..............: avg=1.88ms min=1.05ms med=1.22ms max=68.1ms p(90)=1.62ms p(95)=4.87ms
{ expected_response:true }...: avg=1.88ms min=1.05ms med=1.22ms max=68.1ms p(90)=1.62ms p(95)=4.87ms
http_req_failed................: 0.00% ✓ 0 ✗ 12001
http_req_receiving.............: avg=38.98µs min=21.8µs med=37µs max=707.97µs p(90)=43.61µs p(95)=47.81µs
http_req_sending...............: avg=15.66µs min=11.83µs med=14.29µs max=327.35µs p(90)=17.61µs p(95)=22.86µs
http_req_tls_handshaking.......: avg=0s min=0s med=0s max=0s p(90)=0s p(95)=0s
http_req_waiting...............: avg=1.83ms min=1ms med=1.16ms max=68ms p(90)=1.56ms p(95)=4.82ms
http_reqs......................: 12001 100.005619/s
iteration_duration.............: avg=2ms min=1.16ms med=1.33ms max=76.09ms p(90)=1.75ms p(95)=5ms
iterations.....................: 12001 100.005619/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, 2m30s max duration (incl. graceful stop):
* constant_request_rate: 1000.00 iterations/s for 2m0s (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 (2m00.3s), 000/300 VUs, 56784 complete and 0 interrupted iterations
constant_request_rate ✓ [======================================] 000/300 VUs 2m0s 1000 iters/s
import http from 'k6/http';
✓ response status 200
checks.........................: 100.00% ✓ 56784 ✗ 0
data_received..................: 34 MB 284 kB/s
data_sent......................: 5.8 MB 49 kB/s
dropped_iterations.............: 63218 525.400319/s
http_req_blocked...............: avg=15.01µs min=2.77µs med=4.41µs max=38.01ms p(90)=4.84µs p(95)=7.55µs
http_req_connecting............: avg=9.09µs min=0s med=0s max=37.97ms p(90)=0s p(95)=0s
http_req_duration..............: avg=631.57ms min=322.69ms med=614.17ms max=1.31s p(90)=708.99ms p(95)=751.52ms
{ expected_response:true }...: avg=631.57ms min=322.69ms med=614.17ms max=1.31s p(90)=708.99ms p(95)=751.52ms
http_req_failed................: 0.00% ✓ 0 ✗ 56784
http_req_receiving.............: avg=129.96µs min=21.37µs med=132.93µs max=55.67ms p(90)=158.44µs p(95)=166.46µs
http_req_sending...............: avg=28.7µs min=7.94µs med=13.23µs max=29.44ms p(90)=27.58µs p(95)=32.23µs
http_req_tls_handshaking.......: avg=0s min=0s med=0s max=0s p(90)=0s p(95)=0s
http_req_waiting...............: avg=631.41ms min=322.64ms med=614ms max=1.31s p(90)=708.82ms p(95)=751.36ms
http_reqs......................: 56784 471.927801/s
iteration_duration.............: avg=631.69ms min=322.8ms med=614.27ms max=1.31s p(90)=709.11ms p(95)=751.79ms
iterations.....................: 56784 471.927801/s
vus............................: 300 min=300 max=300
vus_max........................: 300 min=300 max=300
/\ |‾‾| /‾‾/ /‾‾/
/\ / \ | |/ / / /
/ \/ \ | ( / ‾‾\
/ \ | |\ \ | (‾) |
/ __________ \ |__| \__\ \_____/ .io
execution: local
script: stressTest/get.js
output: -
scenarios: (100.00%) 1 scenario, 300 max VUs, 2m30s max duration (incl. graceful stop):
* constant_request_rate: 10000.00 iterations/s for 2m0s (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 (2m00.4s), 000/300 VUs, 57594 complete and 0 interrupted iterations
constant_request_rate ✓ [======================================] 000/300 VUs 2m0s 10000 iters/s
✓ response status 200
checks.........................: 100.00% ✓ 57594 ✗ 0
data_received..................: 35 MB 288 kB/s
data_sent......................: 5.9 MB 49 kB/s
dropped_iterations.............: 1142399 9490.002594/s
http_req_blocked...............: avg=99.28µs min=2.55µs med=3.96µs max=74.83ms p(90)=4.44µs p(95)=5.56µs
http_req_connecting............: avg=67.12µs min=0s med=0s max=51.55ms p(90)=0s p(95)=0s
http_req_duration..............: avg=623.47ms min=334.94ms med=598.16ms max=1.36s p(90)=704.55ms p(95)=755.85ms
{ expected_response:true }...: avg=623.47ms min=334.94ms med=598.16ms max=1.36s p(90)=704.55ms p(95)=755.85ms
http_req_failed................: 0.00% ✓ 0 ✗ 57594
http_req_receiving.............: avg=383.88µs min=18.28µs med=86.76µs max=108.21ms p(90)=115.33µs p(95)=195.92µs
http_req_sending...............: avg=223.78µs min=8.44µs med=12.54µs max=74.93ms p(90)=50.28µs p(95)=102.09µs
http_req_tls_handshaking.......: avg=0s min=0s med=0s max=0s p(90)=0s p(95)=0s
http_req_waiting...............: avg=622.86ms min=334.89ms med=597.98ms max=1.36s p(90)=703.08ms p(95)=754.57ms
http_reqs......................: 57594 478.438102/s
iteration_duration.............: avg=623.88ms min=335.04ms med=598.27ms max=1.36s p(90)=705.61ms p(95)=757.91ms
iterations.....................: 57594 478.438102/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: "120s",
preAllocatedVUs: 100,
maxVUs: 300,
},
}
};
export default function () {
const testUrl = 'http://3.15.228.199:4095//author?authorId=9123456';
const response = http.get(testUrl);
check(response, {
'response status 200': (r) => r.status === 200,
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment