Skip to content

Instantly share code, notes, and snippets.

@jrudio
Created June 7, 2021 04:21
Show Gist options
  • Save jrudio/ee690365d0662a8a08fb13079912f775 to your computer and use it in GitHub Desktop.
Save jrudio/ee690365d0662a8a08fb13079912f775 to your computer and use it in GitHub Desktop.
const { sleep } = require('k6');
const http = require('k6/http');
// const baseURL = process.env.BASE_URL || 'http://localhost:3002/';
const baseURL = 'http://localhost:3000/';
export const options = {
vus: 1000,
duration: '60s',
thresholds: {
// http_req_duration: ['p(95)<2000'],
},
};
const idList = [];
for (let i = 0, j = 9599999; i < 1000; i += 1) {
idList.push(j);
j += 1;
}
const randomID = () => (
idList[Math.floor(Math.random() * idList.length)]
);
export default () => {
const result = http.get(`${baseURL}/${randomID()}`, {
tags: {
name: 'proxy-endpoint',
},
});
sleep(1);
};
/*
/\ |‾‾| /‾‾/ /‾‾/
/\ / \ | |/ / / /
/ \/ \ | ( / ‾‾\
/ \ | |\ \ | (‾) |
/ __________ \ |__| \__\ \_____/ .io
execution: local
script: stress/get.js
output: -
scenarios: (100.00%) 1 scenario, 1000 max VUs, 1m30s max duration (incl. graceful stop):
* default: 1000 looping VUs for 1m0s (gracefulStop: 30s)
running (1m01.4s), 0000/1000 VUs, 40738 complete and 0 interrupted iterations
default ✓ [======================================] 1000 VUs 1m0s
checks.....................: 0.00% ✓ 0 ✗ 40738
data_received..............: 16 MB 263 kB/s
data_sent..................: 3.6 MB 58 kB/s
http_req_blocked...........: avg=15.55ms min=1µs med=2.7µs max=3.16s p(90)=4.1µs p(95)=6.2µs
http_req_connecting........: avg=15.54ms min=0s med=0s max=3.16s p(90)=0s p(95)=0s
http_req_duration..........: avg=472.31ms min=117.32ms med=448.56ms max=2.58s p(90)=525.72ms p(95)=583.69m
http_req_failed............: 100.00% ✓ 40738 ✗ 0
http_req_receiving.........: avg=50.33µs min=16.29µs med=48.9µs max=1.69ms p(90)=67.7µs p(95)=82.3µs
http_req_sending...........: avg=71.46µs min=4.3µs med=8.3µs max=10.09ms p(90)=26.5µs p(95)=38.91µs
http_req_tls_handshaking...: avg=0s min=0s med=0s max=0s p(90)=0s p(95)=0s
http_req_waiting...........: avg=472.19ms min=116.95ms med=448.51ms max=2.58s p(90)=525.66ms p(95)=583.59m
http_reqs..................: 40738 663.886611/s
iteration_duration.........: avg=1.48s min=1.11s med=1.44s max=5.05s p(90)=1.52s p(95)=1.58s
iterations.................: 40738 663.886611/s
vus........................: 317 min=317 max=1000
vus_max....................: 1000 min=1000 max=1000
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment