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
| data | value |
|---|---|
| sessions in the peak hour | 3,600 |
| sessions per second | 3,600 / 3,600 s = 1 |
| average session length | 5 minutes = 300 s |
| concurrent users | 1 x 300 = 300 |
| requests per session | 40 |
| requests per second to the server | 1 x 40 = 40 |
| with 3x headroom | 900 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:
| scenario | share of traffic |
|---|---|
| browses the home page and product lists | 60% |
| uses search | 25% |
| adds to cart | 10% |
| pays | 5% |
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.