Example scenario: load testing an online shop before a campaign
Updated:
This article shows how to measure system capacity before a major campaign, identify a bottleneck and turn the results into clear priorities.
Starting point
Consider an online store before Black Friday or a company preparing to launch a large advertising campaign. The day is approaching when the system may receive several times its usual traffic. Its capacity has not been measured, however, and the team has only its experience from past operations.
Risk in the illustrative situation
Capacity is estimated without a current measurement. The company may then invest in infrastructure it does not need or, conversely, overlook a risk in the purchasing process, the part on which revenue directly depends.
Simple synthetic calls to one address can verify a specific part of the system, but they do not represent all customer behaviour. Customers sign in, search, fill their carts, and pay. If only the average response time is monitored, slower requests may disappear within it.
How we address it
We design scenarios using available data on your users’ behaviour and agreed assumptions. We start from how customers actually move through the system.
Depending on the risk, we select an appropriate combination of load types: expected traffic (load), above-normal load (stress), gradually finding a capacity limit (breakpoint), a sudden peak after an advertising launch (spike), or long-term stability (soak), which can reveal issues such as slow memory leaks.
We measure response-time percentiles (p95 and p99), the error rate, and throughput. If application, database, and infrastructure metrics are available, we compare them on one timeline. The relationships help identify which part of the system is a likely bottleneck and what needs further verification.
We build on the open-source k6 and Locust runners. The performance and configuration of the available infrastructure determine the scope of a local test. Commercial cloud services are not required. We use JMeter for older non-HTTP protocols or when you already have an existing suite.
Turn a traffic estimate into a verifiable profile
This article describes a model, rather than a measurement of a particular shop. First separate campaign-wide visits from their distribution over time. The same daily volume may arrive gradually or in a brief peak. Estimate ordinary intensity, the expected surge and uncertainty that must inform the decision.
Our simplified example: 6,000 visits over 20 minutes average five new visits per second. If each is modelled as an iteration with three HTTP requests, steady execution produces approximately 15 requests per second, provided all three run. This is neither concurrent user count nor a peak estimate. Errors, retries and different journeys change that relationship.
For a planned arrival intensity, an open load model helps. A closed model with a fixed virtual-user count may start fewer operations when responses slow. Choose according to the question and compare planned arrivals with the load actually generated in the report.
Journeys and data must reflect the campaign
Choose the relevant products, filters, baskets and discount rules. Visiting a campaign page may load the system differently from searching and ordering. Agree on the scenario mix using available data and monitor critical operations separately. If analytics are unavailable, label the mix as a working assumption.
Prepare varied test data so that the whole run does not rely on one cached product. Record whether it starts with a warm cache, enabled scaling and substituted external services. Keep payments and orders in controlled test mode. A result with a simulated gateway does not establish its production capacity.
Verify a small functional run before increasing load. Check the generator, access, environment limits and agreed stop conditions too. Do not translate a smaller staging result into production capacity merely by multiplying server counts.
Define success before running the test
k6 uses thresholds as agreed pass/fail conditions for measurement. Specific limits must belong to the product, operation and load phase. The following table illustrates metric selection, rather than an SLA or measured result:
| Operation | What to compare with a limit | What to verify functionally too |
|---|---|---|
| Search | p95 and throughput at the agreed load | Results match the requested filter |
| Order creation | p95, error rate and successful-operation count | Correct items and price, exactly one write |
| Background processing | Queue growth, subsequent draining and completion time | Jobs are neither lost nor executed twice |
An illustrative threshold might require order p95 below two seconds. Meeting it still requires a correct outcome and achieved target load. Distinguish expected business rejection from a technical error so the overall error rate does not mislead.
In k6, also track scheduled iterations that did not start. Investigate their cause. If the generator did not produce the agreed profile, do not describe the result as confirmation of the entire requested capacity.
A bottleneck is a hypothesis to verify
If ordering slows while database wait increases, that provides a diagnostic lead, rather than proof of a single cause. Check slow operations, connection waiting and other simultaneous changes. More CPU may not resolve a blocking query or slow external service.
Compare the repair using the same scenario version under comparable conditions. Where possible, change one cause at a time. Check correct operations and post-load state as well as response times. A faster response with an unsaved order is not a successful optimisation.
A decision and operating plan remain before the campaign
The team receives the assessed scope, limitations, open causes and repair priorities. If the surge is approaching and a cause cannot be confirmed in time, make clear what was verified and which risk remains. Do not infer a universal customer count for every future campaign from the result.
Agree on critical-operation monitoring during the campaign, a response owner and a usable overload procedure. Any restriction of a feature or campaign pace is the company’s decision according to the particular risk. Afterwards, compare actual traffic with assumptions and update the profile for the next measurement.
What you gain
- Capacity measured for specific scenarios and agreed response-time and error-rate limits.
- A likely bottleneck and a plan for confirming the cause before the campaign.
- Evidence for deciding whether and where to invest in infrastructure using measurements.
- Better preparation for the busiest day of operation and a list of remaining risks.
First step
Prepare a typical user scenario, an estimate of expected traffic, acceptable response-time limits, and the campaign date. This information will help determine the test scope and how much lead time is needed for potential changes and repeated measurement.