With the help of Google Analytics concurrent users can be calculated for any given time. You can use the below-mentioned formula to calculate concurrent visitors.
Concurrent Users = 'Hourly Sessions X Average Session Duration (in secs) / 3600
Where to Get Data From in Google Analytics?
You can calculate concurrent users from Google Analytics account.
- Login to Google Analytics account.
- Click the “Reporting” tab.
- Select “Audience” from the sidebar menu.
- Click “Overview”.
- Set the time period for which you want the data.
After you have the data, you need to design a load test.
Must Read: What is Load testing? (An ultimate guide)
Design a Load Test
- Check your site during peak hours of traffic in Google Analytics
- Figure out how many sessions are there
- Perform a test that generates a similar amount of load/traffic.
Note: While performing a load test, add some margins too just to ensure your servers can handle higher traffic levels too.
Why find peak traffic and not just average?
Mostly, the average traffic will be low. Sites usually have regular, recurring peak periods where they experience 2x or more the average traffic levels.
Therefore, it is important to test for that peak traffic.
Reasons for extreme traffic peaks
- There are some sites that have occasional extreme traffic peaks probably due to the nature of the site. For instance, a site declaring the result of XII class or a site selling concert tickets released at a certain date and time.
- User behaviour can also impact the spikes. For example, you have a breakfast recipe site. This means most of the visitors will come to your site just before breakfast. There are possibilities that your site can have peaks much higher than 10x against the average for the site. Therefore, it becomes very important to load test at traffic levels way beyond the averages to ensure your servers don’t end up burning.
Analyze the data
Here’s an example from one of our client’s data.
The site averaged 31.815 concurrent sessions for the entire month.
- 1889337 monthly sessions X 38 seconds per session / 3600 = 19943.001
- 19943.001 / 720 (30 days in June X 24h per day = 720) = 27.698 average concurrent users in June
However, if you calculate the average concurrent sessions for just Jun 29, you will get 31.815 – which is more than the average concurrent users.
Also, if you calculate the average concurrent sessions between 8 PM and 9 PM on that day when there are more users, the average concurrent sessions are 41.4808.
This is almost 2x than the monthly average concurrent users.
- While designing your load test, look at the right numbers and right time frames.
- Even if you don’t have an exceptional spike just like above, there are chances that you will still see temporary peaks. Therefore, spike tests are always a good idea before you start funding, roll out new features or just need to be prepared.
You May Also Like: How to Add Google analytics to Magento 2 stores
Bonus Tip: If you are stuck on performance and load tests, there’s a high chance we have worked in a similar situation before.
If you stuck at any step in calculating concurrent users, leave the query in the comments.