{"canonical_url":"https://engineer.company/glossary/load-test/","content_markdown":"# Load test\n\n## What it is\n\nA load test sends a planned amount of simulated traffic at a system and\nmeasures how the system behaves while it carries it: how long responses take,\nhow many requests fail, how much throughput it sustains and what the servers\nspend doing so. The traffic comes from a script that plays many users at once;\nthe k6 tool calls each of them a virtual user. Load testing is the activity, and\na load test is one run of it, with a shape, a duration and criteria for passing.\n\nThe term is used both broadly and narrowly. The k6 documentation, published by\nGrafana Labs, sorts tests by the load they apply. A smoke test runs a handful of\nvirtual users to prove the script works. An average-load test simulates a\ntypical day in production. A stress test goes above that average, a soak test\nholds average load for hours, a spike test applies a sudden and very high burst\nfor a few minutes, and a breakpoint test keeps raising the load until something\ngives. Because \"load test\" can mean any test that simulates traffic, k6 calls\nthe narrow kind an average-load test and notes that some teams say day-in-life\ntest or volume test. Its guide is candid about the vocabulary: \"no consensus\neven exists about the names of these test types\". The categories are relative\nas well: the load that stresses one application is an ordinary day for another.\n\nA load test is not a functional test. It does not ask whether the checkout adds\nup the basket correctly; it asks whether the checkout still answers, and how\nquickly, while a realistic crowd is using it. The two need each other: a script\nthat sends broken requests at high speed measures only how fast the system says\nno.\n\n## Why it matters\n\nEvery system has a level of traffic at which it stops keeping up, and the only\nquestion is who finds it first. Locust, an open-source load testing tool whose\ntests are plain Python, shows the shape in its quickstart. As the tool adds\nusers, there comes a point, around 20 users in its example, where response\ntimes climb so fast that the number of requests per second stops rising even\nthough more users keep arriving. The documentation calls the target overloaded,\nor saturated. That knee is the real capacity of the system as built, whatever\nthe architecture diagram promises, and it is far cheaper to find in a rehearsal\nthan in front of customers.\n\nThe ramp towards the knee is informative on its own. The k6 guide to\naverage-load tests says the first result appears while load is still rising:\nwhether response time degrades as traffic grows, and whether the system fails\nbefore it even reaches full load. The plateau then shows whether performance\nand resource use stay stable, since some systems turn erratic during exactly\nthat stretch.\n\nLoad tests also turn performance from an opinion into a gate. k6 lets a script\ndeclare thresholds, pass or fail criteria on its metrics, such as fewer than 1%\nof requests failing or 95% of responses arriving within 200 ms. The k6\ndocumentation notes that testers often use thresholds to write down their\nservice level objectives. When every threshold holds, k6 exits with code 0, and\nwhen any fails it exits with a non-zero code, so a pipeline can refuse a\nrelease that made the service slower, with no one reading a graph.\n\n## What it looks like in practice\n\nTake a shop preparing for a sale. Most of the traffic during a sale is people\nwho will not get the item, so the answer that has to hold up is \"sold out\", and\nthat is the path to rehearse first. The test below is written in k6. It starts\nrequests at a set rate rather than with a set number of users, ramps to 2,000\nrequests a second over three minutes, holds that for twenty and ramps down\nagain. The ramp follows k6's guidance for average-load tests: the ramp-up takes\n5 to 15% of the test, the plateau lasts at least five times as long as the\nramp-up, and the ramp-down about as long as the ramp-up. A spike test, which k6\nsuggests for ticket sales, product launches and seasonal sales, would follow\nwith almost no ramp at all; this one first proves that the sold-out answer holds\nat a steady rate.\n\n```javascript\nimport http from 'k6/http';\n\nexport const options = {\n  scenarios: {\n    sold_out: {\n      executor: 'ramping-arrival-rate',\n      startRate: 0,\n      timeUnit: '1s',\n      preAllocatedVUs: 400,\n      stages: [\n        { target: 2000, duration: '3m' },\n        { target: 2000, duration: '20m' },\n        { target: 0, duration: '3m' },\n      ],\n    },\n  },\n  thresholds: {\n    http_req_failed: ['rate\u003c0.01'],\n    http_req_duration: ['p(95)\u003c200'],\n    dropped_iterations: ['count\u003c1'],\n  },\n};\n\nexport default function () {\n  http.get('https://shop.example/sale/items/4711');\n}\n```\n\nRun it with `k6 run sold-out.js`. The number of virtual users is an estimate\nk6's documentation gives a formula for: the median iteration time multiplied by\nthe rate, plus a margin. At 2,000 requests a second and about a tenth of a\nsecond each, 200 virtual users are busy at once, and 400 leaves room. If\nresponses slow down, each iteration lasts longer, the pool runs dry and k6\nrecords every iteration left without a free virtual user in\n`dropped_iterations`. That is why the third threshold is there: a dropped\niteration means the test did not send the load it claims, and k6 notes that the\nsystem may itself be slowing down when the generator drops iterations. The other\ntwo thresholds fail the run if 1% or more of requests fail or the 95th\npercentile is 200 ms or higher.\n\nThe scenario comes from this site's note on\n[selling the last ticket exactly once](/notes/selling-limited-stock-without-overselling/).\nWith a million buyers and ten thousand units, it points out, 990,000 requests\nhave to fail, so the rejection has to be the cheapest answer the system gives.\nIts section on proving the design includes load-testing the rejections: the\nsold-out path has to stay fast when it is 99% of the traffic, and the edge of\nthe network has to absorb it. A test that only rehearses a successful purchase\nmeasures the 1% that matters least to capacity.\n\n## Where it goes wrong\n\n**The test waits for the system it is measuring.** In what k6 calls the closed\nmodel, each virtual user starts its next iteration only when the last one has\nfinished. When the server slows down, the users slow with it, the arrival rate\nfalls and the system gets a gentler test than the one planned, an effect k6\nsays some literature calls coordinated omission. Real visitors do not wait for\neach other. Where the question is whether a system can handle a given rate of\nrequests, use an open-model executor such as `constant-arrival-rate` or\n`ramping-arrival-rate`, which starts iterations on schedule whatever the\nresponse time.\n\n**The load generator is the bottleneck.** If the machine running the test runs\nout of virtual users, CPU or memory, the results describe the generator, not the\ntarget. k6 advises against `maxVUs` in most cases, because adding virtual users\nwhile the test runs costs CPU and memory and can overload the generator and skew\nresults. Size `preAllocatedVUs` beforehand with a few local trials, and watch\n`dropped_iterations`. Locust spreads load over several machines with one master\nprocess and many workers when one is not enough.\n\n**The first run is the biggest.** k6's documentation reports that thousands of\nits users have run load tests that quickly crashed their applications or their\nstaging environments. Start with a smoke test of a few virtual users to prove\nthe script and the environment, then run an average-load test, and only after\nthat a stress test; k6 calls that sequence essential. Problems that appear at\nlow volume are much easier to find before the load is high.\n\n**The load goes up and down like a rollercoaster.** A pattern that rises and\nfalls several times wastes resources and makes it hard to tell which change\ncaused which symptom. k6 recommends one direction at a time: ramp up, hold a\nplateau, ramp down. Keep the scenario, data and environment the same between\nruns as well, so that two results can be compared at all.\n\n**Nobody decided what passing means.** A run that ends with a page of charts\nand no criteria is read differently by everyone who looks at it, usually\ngenerously. Write the thresholds before the run, from the objective the service\nis held to, and let the exit code decide. For long runs, k6 can abort as soon\nas a threshold fails with `abortOnFail`, and `delayAbortEval` keeps it from\nstopping before enough samples have arrived to mean anything.\n\n**One test type is treated as the whole answer.** An average-load test says\nlittle about a sale that arrives in seconds, and a spike test says little about\na fault that only shows after hours of steady use. k6 is explicit that no single\ntest type removes all risk, and that the risk profile decides the mix: a system\nat risk from long use needs soak tests first, one at risk from intensive use\nneeds stress tests. A spike may also exercise processes that never run on an\nordinary day, so the script has to include them.\n\n## Further reading\n\n- [Load test types](https://grafana.com/docs/k6/latest/testing-guides/test-types/)\n  — the k6 overview of smoke, average-load, stress, soak, spike and breakpoint\n  tests, with the load and duration typical of each.\n- [Average-load testing](https://grafana.com/docs/k6/latest/testing-guides/test-types/load-testing/)\n  — how to shape the ramp-up, plateau and ramp-down, and what to read from each.\n- [Thresholds](https://grafana.com/docs/k6/latest/using-k6/thresholds/) — k6's\n  pass and fail criteria, their syntax, and how a failed threshold sets the exit\n  code.\n- [Open and closed models](https://grafana.com/docs/k6/latest/using-k6/scenarios/concepts/open-vs-closed/)\n  — why a test whose users wait for responses under-reports a slow system.\n- [Arrival-rate VU allocation](https://grafana.com/docs/k6/latest/using-k6/scenarios/concepts/arrival-rate-vu-allocation/)\n  — how many virtual users an open-model test needs, and what dropped iterations\n  mean.\n- [What is Locust?](https://docs.locust.io/en/stable/what-is-locust.html) — the\n  Locust documentation's own description of a Python load testing tool and\n  its distributed mode.\n\n\u003chttps://engineer.company/glossary/load-test/\u003e\n","date_modified":"2026-11-08T11:12:58Z","description":"What a load test measures, how it differs from stress, soak and spike tests, how to script one with pass/fail thresholds, and where results mislead.","formats":{"gemtext":"https://engineer.company/glossary/load-test/index.gmi","gopher":"https://engineer.company/glossary/load-test/gophermap","html":"https://engineer.company/glossary/load-test/","json":"https://engineer.company/glossary/load-test/index.json","markdown":"https://engineer.company/glossary/load-test/index.md","pdf":"https://engineer.company/glossary/load-test/index.pdf"},"kind":"page","language":"en","title":"What is a load test?","url":"https://engineer.company/glossary/load-test/","version":1}