Monday, March 3, 2014

Linux-- D state processes and Load Average, Cpu utilization vs Load

In my earlier post , I mentioned about the process states and especially uninterruptable sleep state(D state) in detail..
http://ermanarslan.blogspot.com.tr/2013/08/linux-d-state-processes.html

Today , I feel that, I have to write down the impact of D state processes to the Load Average, because there is a misconception between Load average and Cpu Utilization, and there is ambiguity around me and it is about the processes included in Load average calculations ..

First of all, the processes waiting with an uninterruptable sleep state (D state) , are included in the calculation of Linux Load average. I have already seen these.. When a unrecoverable failure arires NFS disk path and if that disk is used by the process, you will see the D states, and you will see that your Load Average goes high.. So, Linux includes processes in uninterruptible sleep states to its load average..Yes it is so, even if we think that load average calculates running and ready-to-run processes only and these type of processes are usually in wait for DISK I/O..  The design is implemented in this way because, uninterruptable sleeps by concept, can lead a blocking system, as you know these processes can not be kill or stopped before they get what they are waiting for..

So, if you have D state processes, you can expect a high load average..
This is already obviously defined in man pages,

ldavg-1 System load average for the last minute. The load average is calculated as the average number of runnable or running tasks (R state), and the number of tasks in uninterruptible sleep (D state) over the specified interval.

Second, Cpu load is different than Cpu utilization.. This explains why we see Cpu as idle even if the load average is high. The difference can be explained by the following picture:


So , we can have free cpu cyles in system but we should have to wait for other things.. These situation will lead our load average to increase while our cpu utilization does not change..  

Lastly, I will mention about the optimium value for load average..
So if you have one cpu-core machine. The optimum value for maximum load average is 1.
If you have multicore or multicpu machine; our rule of thumb is -> max load average = number of cpu cores.
Of course , multicore and multicpu are different in technology, in terms of cache and etc, but this is what we accept roughly..

No comments :

Post a Comment

If you will ask a question, please don't comment here..

For your questions, please create an issue into my forum.

Forum Link: http://ermanarslan.blogspot.com.tr/p/forum.html

Register and create an issue in the related category.
I will support you from there.