May 19, 2021

Active User != Concurrent Connection

I see a lot of people misunderstand about what is "concurrent connection" for a HTTP/HTTPS server.

They tend to use the "number of active users" is equal to the number of concurrent connections, and this wrong. 

Here, I show you how to estimate the concurrent connection needed for a HTTP/HTTPS server. And I'll introduce the tool that I used too.

Scenario (1):

  • 100 active users
  • (average) 60 requests been made by each user within an hour (1 min 1 click)
  • Each request takes (average of) 2 seconds to complete [slow]

This means there are total of 6000 (100*60) requests been made.

And total of 12000 (6000*2) seconds of active connections needed to be served within 3600 seconds (1 hour).

 Thus, concurrent connection = 12000/3600 = 3.33

Scenario (2):

  • 1000 active users ?
Concurrent connection =  33.3 
 
Scenario (3):
  • Each request is served with 1 second (by a powerful server).
Concurrent connection = 1.7
 
Estimation:
For 100 concurrent connections, your server is able to support around 3000 active users (60 req and 2 sec).

 

Of course, in real life, before you calculate concurrent connection, you need to:

  • Estimate the average number of click or HTTP request is need for a user to complete a transaction (including browsing for items).
  • Estimate the average time (in seconds) needed by your HTTP server to response for each request.
  • Use a tool to make 10 concurrent connections to your HTTP server.
  • And finally you will know how many active users that your application (HTTP server) can support.

Here is a tool, called "autocannon" that I use to perform the 10 concurrent connection to my app server.

# install the tool

$ npm install autocannon -g

# perform 10 concurrent connections to app server.

$ autocannon -c10 http://192.168.1.20


Links:

  • https://github.com/mcollina/autocannon