How much traffic can my web application handle?

More specifically:

  • How many users can we handle?
  • How many requests/second can we handle?
  • How much bandwidth is needed to handle so many users or requests/second?
  • How do i calculate these figures?
  • How many (application) servers do i need to handle this traffic?

Lets begin with a small example to understand how we arrive at answers to the above questions.

Our Application: It is a typical web-application where users browse web pages, do stuff(your business logic), and then leave! Simple enough for our scenario.

Our Server: Tomcat 6 server (with the default 200 worker threads).

So, we can conclude this easily:

We can handle 200 simultaneous requests definitely!(because there are 200 worker threads available to us).

But, how many requests/second can we handle?

For that we need to know what is the average time required by a thread to process requests. This will depend on your application. Let us assume that every thread takes 0.5 second average time to serve a request.

This means we can handle 200 requests/0.5seconds == 400 requests/second.

But, how many users can we handle simultaneously?

This depends on how frequently the user sends requests to the server! Lets say an average user sends a request to the server once in every 10 seconds. So he sends 1 request/10 seconds OR 0.1 request/second.

Since our server can handle 400 requests per second, number of total simultaneous users it can handle is: (400 requests/second) / (0.1 requests/second)

== 4000 (online) users!

How many total users can we support?

If you assume that 5% of users are online at any point in time, then we can support 4000/(5%)==80,000 users.

How much bandwidth is required (bandwidth is provided by data center hosting your server!)?

Lets say every request results in average 20 KB of data by returned in response. Since we can handle 400 requests/second, we need at least 400 x 20 KB = 8000KBps == 8MBps == 64Mbps (NOTE: B=Bytes, b=bits, for simplicity assumed K as 1000 instead of 1024).

Lets summarize, what traffic our web application handle?

  • 4000 simultaneous users. 80,000 total users.
  • 400 requests/second.
  • And we need at least 64Mbps of bandwidth.

Now, this will give a some idea of how to find out what traffic your web application can handle. Here, we are not discussing how to scale your application/server(that is left for another post). Of-course as you scale(for example by using multiple tomcat servers behind a apache load balancer) you will be able to handle larger traffic.

You may be interested in a related post about – How to monitor and improve performance of Apache/Tomcat/MySQL application.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: