From 930622ea3c7f7c761cf45a6c263b5f9fb03cfb07 Mon Sep 17 00:00:00 2001 From: Julien Neuhart Date: Wed, 2 Oct 2019 11:09:21 +0200 Subject: [PATCH] adding load testing results --- internal/pkg/chrome/chrome.go | 12 +-- loadtesting/README.md | 133 +++++++++++++++++++++++----------- loadtesting/merge.js | 18 +++++ 3 files changed, 114 insertions(+), 49 deletions(-) diff --git a/internal/pkg/chrome/chrome.go b/internal/pkg/chrome/chrome.go index 9a206c85..f70b2591 100644 --- a/internal/pkg/chrome/chrome.go +++ b/internal/pkg/chrome/chrome.go @@ -123,7 +123,7 @@ func restart(logger xlog.Logger, proc *os.Process) error { func isViable(logger xlog.Logger) bool { const ( op string = "chrome.isViable" - maxViabilityTests int = 5 + maxViabilityTests int = 20 ) viable := func() bool { ctx, cancel := context.WithCancel(context.Background()) @@ -131,21 +131,21 @@ func isViable(logger xlog.Logger) bool { endpoint := "http://localhost:9222" logger.DebugfOp( op, - "checking Google Chrome process viability via endpoint '%s/json/version'", + "checking Google Chrome headless process viability via endpoint '%s/json/version'", endpoint, ) v, err := devtool.New(endpoint).Version(ctx) if err != nil { - logger.ErrorfOp( + logger.DebugfOp( op, - "Google Chrome is not viable as endpoint returned '%v'", - err, + "Google Chrome headless is not viable as endpoint returned '%v'", + err.Error(), ) return false } logger.DebugfOp( op, - "Google Chrome is viable as endpoint returned '%v'", + "Google Chrome headless is viable as endpoint returned '%v'", v, ) return true diff --git a/loadtesting/README.md b/loadtesting/README.md index a55a3e1b..eb673c9f 100644 --- a/loadtesting/README.md +++ b/loadtesting/README.md @@ -32,34 +32,34 @@ $ k6 run --env MAX_VUS=100 --env BASE_URL=http://ec2-foo.eu-west-1.compute.amazo duration: -, iterations: - vus: 1, max: 100 - done [==========================================================] 1m11.9s / 10m0s + done [==========================================================] 1m17.9s / 10m0s ✗ is status 200 - ↳ 99% — ✓ 179 / ✗ 1 + ↳ 99% — ✓ 201 / ✗ 2 ✗ is not status 504 - ↳ 99% — ✓ 179 / ✗ 1 + ↳ 99% — ✓ 201 / ✗ 2 ✓ is not status 500 - checks.....................: 99.62% ✓ 538 ✗ 2 - data_received..............: 41 MB 576 kB/s - data_sent..................: 8.5 MB 118 kB/s - ✗ failed requests............: 1 0.013895/s - http_req_blocked...........: avg=1.58ms min=2µs med=5µs max=59.73ms p(90)=10.19µs p(95)=20.57ms - http_req_connecting........: avg=1.56ms min=0s med=0s max=59.61ms p(90)=0s p(95)=20.48ms - http_req_duration..........: avg=2.3s min=1.32s med=1.67s max=10.2s p(90)=4.41s p(95)=7.54s - http_req_receiving.........: avg=99.01ms min=127µs med=98.4ms max=154.86ms p(90)=115.92ms p(95)=122.42ms - http_req_sending...........: avg=232.69µs min=133µs med=207µs max=1.16ms p(90)=335.4µs p(95)=382.64µs - http_req_tls_handshaking...: avg=0s min=0s med=0s max=0s p(90)=0s p(95)=0s - http_req_waiting...........: avg=2.2s min=1.21s med=1.56s max=10.2s p(90)=4.32s p(95)=7.45s - http_reqs..................: 180 2.501138/s - iteration_duration.........: avg=2.3s min=1.33s med=1.67s max=10.22s p(90)=4.45s p(95)=7.54s - iterations.................: 180 2.501138/s - vus........................: 12 min=1 max=12 + checks.....................: 99.34% ✓ 605 ✗ 4 + data_received..............: 46 MB 594 kB/s + data_sent..................: 9.6 MB 123 kB/s + ✗ failed requests............: 2 0.025646/s + http_req_blocked...........: avg=1.63ms min=2µs med=4µs max=74.77ms p(90)=9.6µs p(95)=19.66ms + http_req_connecting........: avg=1.61ms min=0s med=0s max=74.59ms p(90)=0s p(95)=19.57ms + http_req_duration..........: avg=2.43s min=1.31s med=1.67s max=10.27s p(90)=5.44s p(95)=8.75s + http_req_receiving.........: avg=97.95ms min=103µs med=93.74ms max=202.48ms p(90)=114.51ms p(95)=132.99ms + http_req_sending...........: avg=231.53µs min=92µs med=201µs max=2.33ms p(90)=310.4µs p(95)=333.59µs + http_req_tls_handshaking...: avg=0s min=0s med=0s max=0s p(90)=0s p(95)=0s + http_req_waiting...........: avg=2.33s min=1.22s med=1.58s max=10.12s p(90)=5.33s p(95)=8.62s + http_reqs..................: 203 2.603019/s + iteration_duration.........: avg=2.43s min=1.31s med=1.68s max=10.27s p(90)=5.45s p(95)=8.75s + iterations.................: 203 2.603019/s + vus........................: 13 min=1 max=13 vus_max....................: 100 min=100 max=100 ``` -In our use case, when reaching 12 virtual users (~2,5 requests per second), some incoming requests cannot be fulfilled before 10 seconds (`DEFAULT_WAIT_TIMEOUT` value). -During this test, CPU usage went from 0 to 100% and memory usage stayed low (Google Chrome go from 64.1 MB to 64.9 MB). +In our use case, when reaching 13 virtual users (~2,6 requests per second), some incoming requests cannot be fulfilled before 10 seconds (`DEFAULT_WAIT_TIMEOUT` value). +During this test, CPU usage was high and memory usage went from 339 MiB to a peak of 421 MiB before going back to 364 MiB. ## Office @@ -81,33 +81,80 @@ $ k6 run --env MAX_VUS=100 --env BASE_URL=http://ec2-foo.eu-west-1.compute.amazo duration: -, iterations: - vus: 1, max: 100 - done [==========================================================] 2m7.9s / 10m0s + done [==========================================================] 47.9s / 10m0s - ✗ is status 200 - ↳ 99% — ✓ 481 / ✗ 3 - ✗ is not status 504 - ↳ 99% — ✓ 481 / ✗ 3 ✓ is not status 500 + ✗ is status 200 + ↳ 83% — ✓ 31 / ✗ 6 + ✗ is not status 504 + ↳ 83% — ✓ 31 / ✗ 6 - checks.....................: 99.58% ✓ 1446 ✗ 6 - data_received..............: 40 MB 312 kB/s - data_sent..................: 45 MB 348 kB/s - ✗ failed requests............: 3 0.023446/s - http_req_blocked...........: avg=1.85ms min=2µs med=5µs max=373.57ms p(90)=12.69µs p(95)=23.84µs - http_req_connecting........: avg=1.11ms min=0s med=0s max=47.62ms p(90)=0s p(95)=0s - http_req_duration..........: avg=2.65s min=289.89ms med=2.48s max=10.08s p(90)=4.51s p(95)=5.43s - http_req_receiving.........: avg=57.15ms min=79µs med=51.53ms max=200.89ms p(90)=81.12ms p(95)=91.61ms - http_req_sending...........: avg=387.86µs min=159µs med=332µs max=3.87ms p(90)=513.1µs p(95)=695µs - http_req_tls_handshaking...: avg=0s min=0s med=0s max=0s p(90)=0s p(95)=0s - http_req_waiting...........: avg=2.59s min=264.48ms med=2.4s max=10.08s p(90)=4.45s p(95)=5.37s - http_reqs..................: 484 3.782635/s - iteration_duration.........: avg=2.65s min=290.24ms med=2.48s max=10.08s p(90)=4.51s p(95)=5.43s - iterations.................: 484 3.782635/s - vus........................: 22 min=1 max=22 + checks.....................: 89.18% ✓ 99 ✗ 12 + data_received..............: 2.6 MB 54 kB/s + data_sent..................: 3.4 MB 71 kB/s + ✗ failed requests............: 6 0.125047/s + http_req_blocked...........: avg=4.39ms min=3µs med=4µs max=24.52ms p(90)=23.27ms p(95)=23.62ms + http_req_connecting........: avg=4.34ms min=0s med=0s max=24.42ms p(90)=23.15ms p(95)=23.52ms + http_req_duration..........: avg=5.34s min=1.74s med=4.33s max=10.83s p(90)=10.24s p(95)=10.25s + http_req_receiving.........: avg=42.49ms min=67µs med=49.1ms max=68.87ms p(90)=57.34ms p(95)=62.06ms + http_req_sending...........: avg=341.91µs min=215µs med=341µs max=724µs p(90)=443.99µs p(95)=514.79µs + http_req_tls_handshaking...: avg=0s min=0s med=0s max=0s p(90)=0s p(95)=0s + http_req_waiting...........: avg=5.3s min=1.7s med=4.27s max=10.83s p(90)=10.24s p(95)=10.25s + http_reqs..................: 37 0.771121/s + iteration_duration.........: avg=5.34s min=1.74s med=4.35s max=10.86s p(90)=10.24s p(95)=10.25s + iterations.................: 37 0.771121/s + vus........................: 8 min=1 max=8 vus_max....................: 100 min=100 max=100 ``` -In our use case, when reaching 22 virtual users (~3,7 requests per second), some incoming requests cannot be fulfilled before 10 seconds (`DEFAULT_WAIT_TIMEOUT` value). -During this test, CPU usage went from 0 to 100% and memory usage stayed low. +In our use case, when reaching 8 virtual users (~0.8 requests per second), some incoming requests cannot be fulfilled before 10 seconds (`DEFAULT_WAIT_TIMEOUT` value). +During this test, CPU usage was high and memory usage went from 315 MiB to a peak of 788 MiB before going back to 307 MiB. -## Merge \ No newline at end of file +## Merge + +The Merge scenario is the same as the previous scenarios, but with a [gotenberg.pdf](../test/testdata/pdf/gotenberg.pdf) and a [gotenberg_bis.pdf](../test/testdata/pdf/gotenberg_bis.pdf). + +```bash +$ k6 run --env MAX_VUS=100 --env BASE_URL=http://ec2-foo.eu-west-1.compute.amazonaws.com merge.js + + /\ |‾‾| /‾‾/ /‾/ + /\ / \ | |_/ / / / + / \/ \ | | / ‾‾\ + / \ | |‾\ \ | (_) | + / __________ \ |__| \__\ \___/ .io + + execution: local + output: - + script: merge.js + + duration: -, iterations: - + vus: 1, max: 100 + + done [==========================================================] 1m45.9s / 10m0s + + ✗ is status 200 + ↳ 98% — ✓ 165 / ✗ 3 + ✗ is not status 504 + ↳ 98% — ✓ 165 / ✗ 3 + ✓ is not status 500 + + checks.....................: 98.80% ✓ 498 ✗ 6 + data_received..............: 69 MB 649 kB/s + data_sent..................: 70 MB 661 kB/s + ✗ failed requests............: 3 0.028302/s + http_req_blocked...........: avg=2.28ms min=2µs med=5µs max=33.24ms p(90)=23.6µs p(95)=23.38ms + http_req_connecting........: avg=2.24ms min=0s med=0s max=33.1ms p(90)=0s p(95)=23.04ms + http_req_duration..........: avg=5.32s min=632.86ms med=5.24s max=10.17s p(90)=9.42s p(95)=9.91s + http_req_receiving.........: avg=122.07ms min=82µs med=114.72ms max=230.35ms p(90)=162.27ms p(95)=188.95ms + http_req_sending...........: avg=16.56ms min=349µs med=1.37ms max=223.25ms p(90)=12ms p(95)=149.76ms + http_req_tls_handshaking...: avg=0s min=0s med=0s max=0s p(90)=0s p(95)=0s + http_req_waiting...........: avg=5.18s min=573.03ms med=5.09s max=10.13s p(90)=9.29s p(95)=9.78s + http_reqs..................: 168 1.58493/s + iteration_duration.........: avg=5.33s min=633.87ms med=5.24s max=10.17s p(90)=9.43s p(95)=9.91s + iterations.................: 168 1.58493/s + vus........................: 18 min=1 max=18 + vus_max....................: 100 min=100 max=100 +``` + +In our use case, when reaching 18 virtual users (~1.6 requests per second), some incoming requests cannot be fulfilled before 10 seconds (`DEFAULT_WAIT_TIMEOUT` value). +During this test, CPU usage was high and memory usage went from 310 MiB to a peak of 604 MiB before going back to 331 MiB. diff --git a/loadtesting/merge.js b/loadtesting/merge.js index 6229743a..29e1db0d 100644 --- a/loadtesting/merge.js +++ b/loadtesting/merge.js @@ -1,9 +1,24 @@ import http from "k6/http"; +import { Counter } from "k6/metrics"; import { check } from "k6"; let pdf1File = open("../test/testdata/pdf/gotenberg.pdf", "b"), pdf2File = open("../test/testdata/pdf/gotenberg_bis.pdf", "b"); +let failCounter = new Counter("failed requests"); + +export let options = { + stages: [ + { duration: "10m", target: __ENV.MAX_VUS } + ], + thresholds: { + "failed requests": [{ + threshold: "count<1", + abortOnFail: true, + }] + } +} + export default function() { var data = { "gotenberg.pdf": http.file(pdf1File, "gotenberg.pdf"), @@ -15,4 +30,7 @@ export default function() { "is not status 504": (r) => r.status !== 504, "is not status 500": (r) => r.status !== 500, }); + if (res.status !== 200) { + failCounter.add(1); + } } \ No newline at end of file