Linux Server Load With Top

March 25, 2008 – tagged as linux, top

I always find it interesting when I believe something to be true for years and then one day someone says, “that’s incorrect.” Today was one of those days.

In Unix, Linux, OS X, or most any good operating system, you’ll find a standard command called top. It’s a simple programs that, according to the manual, “provides a dynamic real-time view of a running system.” At the top of the top (heh) output is a header that looks like:

top - 15:43:10 up 14 days, 15:25,  4 users,  load average: 0.27, 0.12, 0.10
Tasks: 106 total,   2 running, 104 sleeping,   0 stopped,   0 zombie

Note the top right load average numbers. I had always thought that those numbers represented the percent load on the processor averaged over the last minute, 5 minutes, and 15 minutes respectively. Well, I was right about the time intervals, but wrong about the information. The load actually reflects system load such that a value of 1 means the processor on average had 1 process waiting to run, i.e., was loaded 100%. So, in the values above, the CPU was only 27% busy over the last minute, 12% in the last five, and 10% in the last 15. Anything over 1 means that there is an overload and a queue of pending processes.

This would explain why I saw values of 40 when OmniNerd was last Slashdotted. I thought the server was doing well with a 40% load. In reality it had a 4000% load and was dropping requests left and right.

Live and learn.