This is one calculation, done slowly, from the business target to the number you type into the load tool. We will use an invented online grocery app, and then break the test on purpose to see what it hides.

Step 1: start from throughput, not users

The business says: on sale evening we expect the busiest hour to bring 600 orders per minute at checkout. First convert to the unit tools prefer, per second. 600 divided by 60 is 10 orders per second. This number, throughput, is what the system must sustain. “How many users?” is a derived question, and people who start from it usually guess.

Step 2: measure how long one user’s loop takes

A virtual user in a script does a journey and then starts again. Say the checkout journey, as recorded, has a combined server response time of 0.8 seconds for its steps, and real users pause between steps to read, type an address, choose a slot. The script includes those pauses, called think time, adding up to 12 seconds. One full loop is therefore 0.8 plus 12, which is 12.8 seconds.

Think time comes from analytics or observation of real sessions, not from the tester’s imagination. Setting it to zero because “it makes the test harder” is a common error; it produces a load shape no real population creates, and it makes the number of users meaningless.

Step 3: apply Little’s Law

Little’s Law, from queueing theory, says that the average number of items in a stable system equals the arrival rate multiplied by the average time each spends in it. Here the “items” are active virtual users, the rate is 10 journeys per second, and the time is 12.8 seconds. 10 times 12.8 equals 128 virtual users.

Check it the other way: each user completes one journey every 12.8 seconds, which is about 0.078 journeys per second. 128 users times 0.078 gives 10 per second. Consistent.

Step 4: add headroom

Nobody should size capacity exactly to the forecast. If you want to prove the system handles 1.5 times the expected peak, the target is 15 per second, and the user count becomes 15 times 12.8, which is 192. Run the load in stages: 50% of peak, 100%, 150%, each held long enough (often 15 to 30 minutes) to reach steady state, so you can see where behaviour changes rather than only whether the final stage survives.

Step 5: now watch it lie to you

Suppose at the 100% stage the database starts struggling and response time rises from 0.8 to 3 seconds. In a typical script each virtual user waits for its response before continuing. The loop is now 3 plus 12, which is 15 seconds. With a fixed 128 users, throughput becomes 128 divided by 15, about 8.5 journeys per second. The tool quietly slowed its own arrival rate because the users were stuck waiting.

This is a closed workload model: a fixed population, and its load falls as the system slows. Real shoppers on a sale evening are closer to an open model, where new customers arrive at a rate that does not care how slow you are. They keep coming at 10 per second, and the queue grows. A closed-model test therefore looks kinder to a struggling system than reality will be. The final report might even show “8.5 orders per second, no errors”, which a skimming reader takes as nearly meeting the target.

Many tools can drive an arrival rate directly. k6 has executors that start iterations at a fixed rate, and JMeter has throughput-oriented timers and plugins, though the options differ by tool and version. When available, use arrival-rate mode for public-facing flows, and a closed model for internal systems with a bounded user group, such as a few hundred back-office staff.

Step 6: sanity-check the result against the target

Whatever the tool reports, divide achieved throughput by planned throughput first. If the plan was 10 per second and the system achieved 8.5, the test did not reach the target, regardless of green ticks on error counts. Only then look at percentiles of response time and resource graphs for the servers and database.

Limits of this arithmetic: it needs averages that are stable over the measurement window, so it fits a plateau rather than the ramp-up; it ignores that different journeys (browse, add to cart, pay) come in a mix, so in practice you compute each journey’s share of the 10 per second and size them separately; and the load generator itself must have enough CPU and network to produce the load, or it becomes the bottleneck you then mistake for the application’s.

Figures and names in the examples are illustrative.

Leave a Reply

Trending