DEV Community

Raiyan Memon
Raiyan Memon

Posted on

Determine Server Capacity to handle the requests

Knowing how much load your server can take at once is crucial.

In this blog, we will learn how many requests your server can handle at once.

We are going to fire an Apache Command with some configurations in it to know the capacity of our server and push it to its limit so that we get to know whether to increase the size of our server or add a load balancer to it.

A command line tool that we are going to use is known as ApacheBench (ab). It tests the performance of a server by sending a specified number of requests and measuring the response times.

Also provides insights like requests per second, time taken per request, and transfer rates.

Copy and paste the below command on the local or live server works but make sure the apache2 server is installed.

ab -n 1000 -c 10 https://raiyanmemon.in/

If you are getting any error try with “http” rather than using “https”.

It mostly throws an error of ssl with “https” just on the local server but works same.

Here’s a breakdown of the parameters:

ab: Apache Bench.
-n 1000: The total number of requests to send. In this case, 1000 requests.
-c 10: The concurrency level, meaning 10 requests will be sent simultaneously.
https://raiyanmemon.in/: The URL of the server you are testing. At last, the forward slash (/) is mandatory.
You can change the number of requests or the concurrency level if you want to create a heavy load on your server.

You can also change your server URL to an IP address something like this: http://192.168.1.17/

Your Response to the above command will be like this:

Server Software:        *******
Server Hostname:        raiyanmemon.in
Server Port:            443
SSL/TLS Protocol:       *************
Server Temp Key:        ********
TLS Server Name:        raiyanmemon.in

Document Path:          /
Document Length:        9607 bytes

Concurrency Level:      10
Time taken for tests:   4.202 seconds
Complete requests:      100
Failed requests:        0
Total transferred:      1029945 bytes
HTML transferred:       960700 bytes
Requests per second:    23.80 [#/sec] (mean)
Time per request:       420.214 [ms] (mean)
Time per request:       42.021 [ms] (mean, across all concurrent requests)
Transfer rate:          239.36 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:      119  136  48.9    123     344
Processing:    40  129 259.1     42    1317
Waiting:       40  128 259.1     42    1316
Total:        160  264 302.3    165    1661
Enter fullscreen mode Exit fullscreen mode

Note: Just spend some time to analyse the response and you will get to understand how simple it is.

After hitting the command to know whether the command has an effect or not, just log in to your server and see the CPU usage you will notice an instant hike.

If you didn’t notice any change on the CPU try increasing your number of requests and concurrency level.

This is it. You are ready to test your server capacity to handle the requests.

Feel free to comment if you have any recommendations.

Keep coding and exploring ❤️

Top comments (0)