1755726 Members
2708 Online
108837 Solutions
New Discussion юеВ

sar -q or vmstat?

 
Dale Edmunds_1
Occasional Contributor

sar -q or vmstat?

Hi,

Just a quck question: if I use "sar -q" to look at the CPU run queue size, typically the values for runq-sz are lower (sometimes zero) than if I use vmstat and look at the 'r' column under 'procs'.

Can someone tell me why, and what's the difference between the sar and vmstat output? We're not sure which values to use for determining the CPU run queue length..

Regards

Dale
4 REPLIES 4
Ninad_1
Honored Contributor

Re: sar -q or vmstat?

As I understand the r in vmstat shows the runnable processes at that time where as the run-queue in sar -q shows the average queue of runnable processes on each CPU.
Thus if you have 10 runnable processes and you have 4 CPUs the run-queue will be 2.5.

I have never compared the two outputs but it may be like the run-queue * no of processors = r in vmstat
But again these figures may not exactly match as the collection period may not exactly coincide and dont know for what all reasons.

Regards,
Ninad
Dale Edmunds_1
Occasional Contributor

Re: sar -q or vmstat?

Hi,

Thanks for the reply. Essentially my understanding is the runq-sz value from sar-q is the average number of processes waiting on CPU. Each node in our cluster has 8 CPU's, so if I have a runq-sz greater than 8 - I have processes queueing on CPU.

If I combine your information, essentially the 'r' value from vmstat is the runq-sz from sar multiplied by the number of procs?

So if I want a definitive "we have processes queuing on CPU" answer - sar is a better metric?

Regards

Dale
Ninad_1
Honored Contributor

Re: sar -q or vmstat?

OK, the best thing I would suggest you to do is if you have glance installed.

echo "PRINT GBL_CPU_TOTAL_UTIL,GBL_RUN_QUEUE,GBL_PRI_QUEUE" > mysyntax
glance -adviser_only -syntax mysyntax -j 5 -iterations 10

Now to conclude that you have a CPU queue - just dont rely on the queue figure because many times it so happens that there are a lot of short lived runnable processes on the system and it often results in high CPU queue. But what you should look at is if there is any Priority queue as well - meaning process is waiting for getting its priority raised so as to be executed on a CPU.
Thus if you see high CPu usage, run queue and priority queue then you have a CPU bottle neck

Regards,
Ninad
Dale Edmunds_1
Occasional Contributor

Re: sar -q or vmstat?

Hi,

Thanks - I'll get onto this and do some more digging. Thanks for your help, I'll put some points on the board when I have the results :o)

Regards

Dale