Conrad monitoring

Load testing

Load testing a storefront with k6 — smoke, load, stress, spike and soak tests, realistic journeys and URL mixes, thresholds, and what to watch while the test runs.

From the k6 line of your Monitoring note.

Know

  • k6: a load testing tool where the test is JavaScript: virtual users run the default function in a loop, stages shape the load, thresholds decide pass or fail, check asserts on responses. Runs locally, in CI or in Grafana Cloud.
  • Test types: smoke (a few users, does it work), load (expected peak, held), stress (raise until it breaks), spike (sudden jump, like a newsletter), soak (normal load for hours, finds leaks).
  • Make it realistic: staging sized like production, real journeys (home, category, product, search, cart), many different URLs so the cache behaves like in real traffic, think time between pages.
  • During the test: watch the dashboards, pod count and scaling, memory, event loop lag, Redis, backend APIs; the result that matters is what gives up first.

Exercise

Exercise
  • Install k6, write a test that ramps up to a peak and holds it, with thresholds on p95 and the error rate, against a local Nuxt app with a cached and an uncached route, and compare p95 and the error rate.
  • Run a short soak test while watching memory in the process, and explain what a leak would look like.

Be able to say

Be able to say· How would you make sure the shop survives a big sale?

"Load test it on staging sized like production with k6: realistic journeys and many different product URLs so the cache behaves like real traffic, ramp up to the expected peak and beyond, and a spike test for the moment the newsletter goes out. Thresholds on p95 and error rate make it pass or fail. While it runs I watch the dashboards to see what gives up first: pods not scaling fast enough, the event loop, Redis or a backend API. Then fix that, pre-scale for the event, and run it again."

Your notes

Open in Notes

Nothing yet. Notes filed here show up on this page and the section overview.