Skip to content
TestLine Menu
TestLine
performance

How many users to simulate in a load test? How to build a traffic model

A formula for concurrent users, a worked example for an online shop, splitting traffic into scenarios and the mistakes that inflate or understate the result.

author
Artur Machowski, Senior QA Engineer
published
reading
6 min

Short answer

You work out the number of virtual users from peak-hour traffic, not from the total number of users. The formula (Little’s law): concurrent users = sessions per second x average session length in seconds. Example: 3,600 sessions in the peak hour is 1 session per second. With a 5-minute session (300 seconds), that gives about 300 concurrent users. Then you add headroom, usually 2-3 times, and check at what load the system stops meeting the agreed thresholds.

Step 1: peak-hour data

From analytics or server logs, take the busiest hour of the last 3-12 months, not the daily average. Traffic within an hour isn’t even either: a promotion launch or a newsletter send concentrates it in a few minutes. If you have per-minute data, look at the busiest 5-15 minutes.

You need three numbers:

  • the number of sessions in the peak hour,
  • the average session length,
  • the average number of server requests per session (from logs or the browser’s developer tools).

Step 2: concurrent users

datavalue
sessions in the peak hour3,600
sessions per second3,600 / 3,600 s = 1
average session length5 minutes = 300 s
concurrent users1 x 300 = 300
requests per session40
requests per second to the server1 x 40 = 40
with 3x headroom900 users, 120 requests per second

Requests per second often matter more than the number of users, because that’s what the server sees.

Step 3: splitting traffic into scenarios

Real users don’t all do the same thing. An example split for an online shop:

scenarioshare of traffic
browses the home page and product lists60%
uses search25%
adds to cart10%
pays5%

Take the split from analytics. The most expensive path usually has the smallest share: payment touches the database, stock and the payment gateway, so even 5% of traffic can be the bottleneck.

Step 4: think time and ramp-up

  • Think time: a pause between steps, matching the time spent reading a page, usually several to a dozen or so seconds. Without it, virtual users click non-stop and generate many times more requests than real ones.
  • Ramp-up: users start gradually, e.g. over 5-10 minutes. Starting everyone in the same second is a separate test, a spike test.

In JMeter you set think time with a timer, e.g. Uniform Random Timer. When you want to hold a fixed number of requests per second regardless of response times, use Precise Throughput Timer. I describe the test plan in detail in your first performance test in JMeter. A comparison with k6 is in JMeter vs k6.

The most common mistakes

  • registered users used as the number of virtual users: the test checks a situation that won’t happen;
  • daily average instead of the peak: the test passes, and the system falls over on Monday at 10:00;
  • no think time: load overstated several times, so scaling conclusions go the wrong way;
  • one scenario instead of a traffic split: everyone browses products, nobody pays, so the bottleneck in payments stays invisible;
  • assumptions not written down: six months later nobody knows why the test was for 300 users.

How I can help

A traffic model is part of my performance testing: I work it out from your analytics and logs, prepare 3-5 JMeter scenarios and a report with response times and error thresholds. It usually costs PLN 10,000-15,000 net and takes 2-3 weeks. Before a campaign, the Black Friday performance test checklist will also help. Describe your system and expected traffic in the contact form.

Frequently asked questions

How many users should I simulate in a load test?

As many as are active at the same time in the peak hour, plus headroom. The formula is sessions per second times average session length in seconds. 3,600 sessions an hour with a 5-minute session gives about 300 concurrent users.

Is the number of virtual users the number of app users?

No. An app with 50,000 registered users may have 200-300 people active at the same time at peak. A test with 50,000 virtual users checks a situation that won't happen.

How much headroom above the peak should I allow?

Usually 2-3 times the highest peak in the data. Before a campaign or Black Friday, take the peak from the previous campaign of that kind and add the planned growth in traffic.

Where do I get data for a traffic model?

From analytics (e.g. GA4): sessions in the busiest hour, average session length, the most popular paths. From server logs: API requests per second. Without data, use business assumptions and write them down in the report.

What is think time and should I set it?

It's a pause between a virtual user's steps, matching the time spent reading a page. Without it, 300 virtual users generate many times more requests than 300 real ones, so the test overstates the load.

Got a release in a few weeks?

Describe your project in the form. I'll reply with questions about scope or an initial test plan.