Skip to content

Instantly share code, notes, and snippets.

@paullferguson
Created May 29, 2020 04:43
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 paullferguson/ef55cb40c94df0f55d45977c8e48ec52 to your computer and use it in GitHub Desktop.
Save paullferguson/ef55cb40c94df0f55d45977c8e48ec52 to your computer and use it in GitHub Desktop.
/* eslint-disable import/no-unresolved */
import http from 'k6/http';
import { sleep } from 'k6';
export const options = {
vus: 1000,
duration: '2s',
};
// MySQL
// const dbRows = 100;
// Postgres
const dbRows = 10000000;
export default function () {
const random = Math.floor(Math.random() * dbRows) + 1;
http.get(`http://127.0.0.1:3030/restaurant/${random}`);
sleep(1);
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/\ |‾‾| /‾‾/ /‾/
/\ / \ | |_/ / / /
/ \/ \ | | / ‾‾\
/ \ | |‾\ \ | (_) |
/ __________ \ |__| \__\ \___/ .io
execution: local
output: -
script: k6.js
duration: 2s, iterations: -
vus: 1000, max: 1000
WARN[0016] Request Failed error="Get \"http://127.0.0.1:3030/restaurant/3702372\": dial tcp 127.0.0.1:3030: connect: connection reset by peer"
done [==========================================================] 2s / 2s
data_received..............: 210 kB 105 kB/s
data_sent..................: 60 kB 30 kB/s
http_req_blocked...........: avg=37.22ms min=0s med=40.44ms max=109.88ms p(90)=70.28ms p(95)=73.65ms
http_req_connecting........: avg=36.93ms min=0s med=40.09ms max=109.06ms p(90)=70.07ms p(95)=73.43ms
http_req_duration..........: avg=659.68ms min=0s med=747.63ms max=1.06s p(90)=1s p(95)=1.02s
http_req_receiving.........: avg=44.34µs min=0s med=38µs max=413µs p(90)=67µs p(95)=85µs
http_req_sending...........: avg=492.56µs min=0s med=282µs max=5.5ms p(90)=1.26ms p(95)=1.97ms
http_req_tls_handshaking...: avg=0s min=0s med=0s max=0s p(90)=0s p(95)=0s
http_req_waiting...........: avg=659.14ms min=0s med=747.09ms max=1.06s p(90)=999.98ms p(95)=1.02s
http_reqs..................: 1288 643.999473/s
iteration_duration.........: avg=1.78s min=1s med=1.78s max=1.94s p(90)=1.91s p(95)=1.93s
iterations.................: 618 308.999747/s
vus........................: 1000 min=1000 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