[asterisk-users] Is there real benefits on a SMP machine for Asterisk?

Tzafrir Cohen tzafrir.cohen at xorcom.com
Sat Oct 13 09:03:32 CDT 2007


On Sat, Oct 13, 2007 at 03:31:09PM +0200, Philipp Kempgen wrote:
> Tzafrir Cohen wrote:
> 
> > The loadavg is the average number of threads[0] ready to run (or running).
> 
> To me it seems that there are important differences between
> systems, especially Linux/Unix, as of which of the states in
> following are counted in:
> - running (i.e. using the CPU)
> - runnable (i.e. waiting for their turn)
> - uninterruptible sleep (i.e. waiting for disk/network I/O)

Load average is for both "running" and "runnable".

The test is simple: 


a 100% cpu loop is easy to create  (while :; do :; done   in bourne
shells such as bash, pick your favorite environment. Run as many as you 
want).


Strangely enough in Linux the load avarage includes also processes in a
"uninterruptable sleep" (state "D" in top and ps, as opposed to "S",
which is where processes normally are).

Processes staying long in uninterruptable sleep usually mean a trouble
of some sort.

> 
> Without knowing how your kernel calculates the loadavg the
> usefulness of this value is very limited.
> 
> > We are all well
> > familiar with a single CPU and single core systems. In those systems
> > only one thread can execute at each time. If the load average is greater
> > than 1 it means that there on the average[1] at least one process
> > waiting for the CPU and not getting executed immediately.
> 
> So what you're implying is that only runnable (i.e. waiting)
> threads are counted, not running threads.

Running threads sure are counted.

> The question is if there are any differences on a multi-CPU
> system. Waiting threads would still be waiting threads, no
> matter how many CPUs /could/ run the thread /if they were idle/.
> Is that correct?
> 
> The mistake people often seem to make is to assume that
> loadavg == cpu usage.

It is a good indication. Even a better indicaton to the ammount of
threads ("processes") starved for CPU time.

-- 
               Tzafrir Cohen       
icq#16849755              jabber:tzafrir.cohen at xorcom.com
+972-50-7952406           mailto:tzafrir.cohen at xorcom.com       
http://www.xorcom.com  iax:guest at local.xorcom.com/tzafrir



More information about the asterisk-users mailing list