How Is Linux Server Load Calculated?
View Server Load
Simply SSH into your server and run the “top” command.
Output from “top” command on our dev server:
top - 20:50:15 up 182 days, 14:51,, 3 user, load average: 0.08, 0.16, 0.21 Tasks: 141 total, 1 running, 140 sleeping, 0 stopped, 0 zombie Cpu(s): 2.0%us, 1.3%sy, 0.0%ni, 96.4%id, 0.3%wa, 0.0%hi, 0.0%si, 0.0%st Mem: 873392k total, 687168k used, 186224k free, 15104k buffers Swap: 1959920k total, 194916k used, 1765004k free, 184772k cached
From the above command you can see the important 3 figures: load average: 0.11, 0.11, 0.09.
With this information we know that over the last 1 minute the linux server has had an average load of 0.11, the other two numbers are the 5 minute and 15 minute averages. A single CPU server can perform all tasks in real time until the load is greater than 1.00. A dual CPU server can preform all tasks in real time until the load goes above 2.00 and so on…
Small spikes above your server’s maximum real time load are not a problem, but most sysadmin will only run a server around 70-80% capacity for stability. Very high load averages can slow down the websites and applications hosted on that server. Prolonged linux server load can even lead to service failures such has Apache or MySQL.
Multicore vs. multiprocessor
Is a linux server with a single dual-core processor equivalent to a machine with two processors with one core each? Yes, roughly. There are lots of subtleties here concerning the amount of cache, frequency of process hand-offs between processors, etc. Despite those finer points, the total number of cores is what matters, regardless of how many physical processors those cores are spread across.
Monitor Linux Server Load
Munin is a web based resource usage tool, great for viewing your average load over hours/days/weeks/months/years, as seen in the image top right. If you are using a cPanel/WHM server Munin is already included with your cPanel installation. Just visit WHM >> cPanel >> Manage Plugins to activate this plugin.
A few other great load monitoring scripts include Loadmon and Loadwatch, both will create a dump of the TOP, MYSQL and Mem outputs into a text file when the load exceeds a defined level.
Correct High Server Load
Every case of high server load will have a reason. Using log files generated by cpanel or loadmon/loadwatch we can find out what is the likely cause of high load.
Top reasons for high load are:
- Overcrowding – Too many sites on one server will only end badly so be realistic and keep an eye on your recent linux server load levels and resource usage.
- Traffic Spike – Any blog post can go viral and create massive amounts of load due to high traffic demands.
- Low Free RAM – When the physical RAM is used up by application demands, the system starts to use swap memory (hard drive space acting as RAM). This is much slower and will increase the server load. Check your RAM usage; if it’s border line you should really upgrade. Don’t leave it for a googlebot crawling your sites to make your server load hit it’s limits and cause an outage.
- Failing Drive – Failing hard drives can cause very high load, as the drive takes longer to read data due to the error correction, make sure IO errors are investigated.
- Backups – Running a full server backup uses resources and can cause a load spike every day at the same time, always run these tasks between 1am-3am.