Skip to content

Instantly share code, notes, and snippets.

@mwitz8
Created February 13, 2021 03:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mwitz8/1094f1beb0fe22c02c71b3fff352a0db to your computer and use it in GitHub Desktop.
Save mwitz8/1094f1beb0fe22c02c71b3fff352a0db to your computer and use it in GitHub Desktop.
import http from 'k6/http';
import { sleep } from 'k6';
import { Rate } from 'k6/metrics';
let errorRate = new Rate('errorRate');
export const options = {
thresholds: {
'errorRate': [
{ threshold: 'rate < 0.01', abortOnFail: true, delayAbortEval: '1m' }
]
},
stages: [
{ duration: '5s', target: 100 },
{ duration: '5s', target: 150 },
{ duration: '5s', target: 200 },
],
};
export default function () {
let resp = http.get('http://18.222.40.18:3000/api/location');
errorRate.add(resp.status >= 400);
sleep(1);
}
/\ |‾‾| /‾‾/ /‾‾/
/\ / \ | |/ / / /
/ \/ \ | ( / ‾‾\
/ \ | |\ \ | (‾) |
/ __________ \ |__| \__\ \_____/ .io
execution: local
script: k6test.js
output: -
scenarios: (100.00%) 1 scenario, 200 max VUs, 45s max duration (incl. graceful stop):
* default: Up to 200 looping VUs for 15s over 3 stages (gracefulRampDown: 30s, gracefulStop: 30s)
running (16.1s), 000/200 VUs, 1734 complete and 0 interrupted iterations
default ✓ [======================================] 000/200 VUs 15s0
data_received..............: 864 kB 54 kB/s
data_sent..................: 165 kB 10 kB/s
✓ errorRate..................: 0.00% ✓ 0 ✗ 1734
http_req_blocked...........: avg=6.34ms min=0s med=0s max=67.99ms p(90)=52.33ms p(95)=54.99ms
http_req_connecting........: avg=6.33ms min=0s med=0s max=67.99ms p(90)=52.16ms p(95)=54.99ms
http_req_duration..........: avg=58.12ms min=49.96ms med=56.99ms max=105.65ms p(90)=63.02ms p(95)=67ms
http_req_receiving.........: avg=115.38µs min=0s med=0s max=1.99ms p(90)=965.65µs p(95)=1ms
http_req_sending...........: avg=12.9µs min=0s med=0s max=1.29ms 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=57.99ms min=49.96ms med=56.98ms max=104.62ms p(90)=63ms p(95)=67ms
http_reqs..................: 1734 107.400432/s
iteration_duration.........: avg=1.06s min=1.04s med=1.05s max=1.15s p(90)=1.11s p(95)=1.11s
iterations.................: 1734 107.400432/s
vus........................: 15 min=15 max=199
vus_max....................: 200 min=200 max=200
C:\Users\mattw\Documents\Galvanize\thomas-mcnutt-service>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment