Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I calculate the number of concurrent users to use in a load test?

We’ve come across this question fairly often at Load Impact, so I thought I’d add it to the Stack Overflow community to make it easier to find.

How do I calculate the number of concurrent users (VUs) that I need to simulate during a load test, in order to stress my system with the same kind of traffic that it will normally see in the course of a month, week or day?

like image 437
Ragnar Avatar asked Apr 01 '15 12:04

Ragnar


People also ask

How many concurrent users are needed for load test?

Capacity limits depend on the monitoring platform type due to the difference in test execution algorithms: For HTTP (S) test each Load Injector can handle approximately up to 1000 concurrent HTTP users. For Web page or Web application test each Load Injector can handle approximately up to 25 concurrent users.

How does JMeter calculate concurrent users?

How to Calculate Target Concurrent Users. A common method is to divide the number of unique users by the average visit duration for a given period. For example, 12,000 unique visitors per hour / ( 60 minutes / 15 minutes per visit ) would equal 3,000 concurrent users.

What is concurrent user hits in load testing?

The idea behind concurrent user testing is to identify the response time of a website for a specified number of concurrent users making requests to a website. Concurrent user testing measures how long it takes the server to respond to a specified number of concurrent requests.


1 Answers

Running a load test requires that you specify how many concurrent users should be simulated during testing. In other words, how many simulated users will be active, loading things or interacting with your site/app at the same time. Unfortunately, when looking at Google Analytics for example, we only see how many visits a website has per day or per month. A site can have a million visits per month, but still only ever experience max 100 concurrent visitors.

To convert the "visits per X" metric from Google Analytics, or some other analytics system, into a "concurrent users" metric that you can use for load testing, you can use the following method.

First, find out two things:

  1. You need the total number of visits for a short time period when your site/app is at peak traffic levels. This can easily be found via e.g. Google Analytics by seeing what the highest number of visits was for a single hour in the course of e.g. a month. Look at the day that has seen the highest number of visits, and drill down to see what hour of that day was the busiest and how many visits you had during that hour. Note this value down. I will call this value "peak_hourly_visits" in this text.

  2. You need to know the average time a user spends interacting with your site/app. In Google Analytics this is called "Average session duration" and I will call it that in this text also, but sometimes it is called "Average time on site". If this value changes a lot for your site/app depending on which time period you look at you might want to use one of the larger values you find, to be on the safe side. We want all times in seconds, so if e.g. Google Analytics tells you "00:03:19" (3 minutes, 19 seconds) you should note down 199 as the average session duration.

When you have those two values you use this formula to calculate the number of concurrent users to use in your load test:

concurrent_users = (peak_hourly_visits * average_session_duration) / 3600

Provided that each simulated user (VU) in your load test behaves realistically (i.e. simulates a real user well), you will now be able to stress your site/app with the same kind of traffic that it normally only sees during peak traffic hours.

like image 57
Ragnar Avatar answered Oct 24 '22 09:10

Ragnar