Investigating server load on a Linux server - VPS/Cloud
This article contains a very small set of examples on how you can find who and what is taking too much server resources. This article applies for our Linux VPS/Cloud servers only.
1) If you are using cPanel/WHM control panel, you can login to your WHM control panel and find out which site has the most CPU/mem utilization by reviewing the "Daily Process Log".
In your WHM control panel simply navigate to: Main >> Server Status >> Daily Process Log - you can sort the report based on a Date so that you can review historically who and what is consuming your server resources.
Once you login to your server via SSH, you can execute commands such as: "top" which will give you a current snapshot of what is going on with your server and determine what is causing the actual load.
In 90% of the time, the issue is related to a site (Virtual Domain) with heavy CPU/memory utilization which a lot of time will tax your Web Server (Apache/nginx) and/or your MySQL database. To get an idea of what is currently overloading your Web Server, you can use "apache-top".
To install and apache-top, simply execute the following commands once you login to your server via SSH:
chmod +xr ./apache-top.py
To run the tool you can fire up:
Once you start the tool you will be able to get a lot of useful information and almost immediately you will find out what is causing the load on your server. Type "h" as using the tool to see all available commands. You can sort the display by Virtual Host (domains), Requests Type, pressing "Shift+C" sorts the view by CPU usage for example.
There are many other tools you can use under Linux to troubleshoot load, including mytop (useful for MySQl troubleshooting), sar, vmstat. We recommend that if you are not familiar with Linux administration to consult with an administrator or consultant who can help you administrate and maintain your server and websites on daily basis.