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

Tzafrir Cohen tzafrir.cohen at xorcom.com
Mon Oct 15 06:01:51 CDT 2007


On Mon, Oct 15, 2007 at 12:01:12PM +0200, Andreas Sikkema wrote:
> > > 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.
> 
> On a quad core Linux machine it is possible to have a totally 
> unusable machine with a loadavg of 4 or a perfectly usable 
> machine with loadavg of 10.

First-off, Asterisk is not yourordinary process. Asterisk needs to get
the CPU fast, or else you'll get clicks.

If on your system Asterisk needs to compete with mysql, apache and such,
you can give Asterisk an edge with the option -p. This means that other
processes will get the CPU only when Asterisk is done.

So in that case the load avarage becomes a bit tricky: which of those
processes have a high enough priority to starve Asterisk? Such a
priority can only be by other Asterisk threads or by interrupt handling
in the kerenl (e.g: disk work, networking).

In both those scenarios Asterisk is delayed too long before it gets to
the CPU.

> 
> If you look at loadavg alone you never get the "full" picture.
> 
> In the first case the CPU load on all cores is 100% while the 
> CPU load in case number two could be something around 25% on 
> each, but they are all doing very I/O intensive stuff.
> 
> I frequently see machines doing loads of over 4 with total CPU 
> load not above 100% (of 400% possible)

Well, a load avarage is an avarage over time. A sudden spike where the
CPU had a queue of 30 processes banging of it will leave a slowly
decreasing load.

Consider the following (in bash or any other decent bourne shell with
job control enabled, and assuming that there are no jobs running)

(while :; do :; done) &
(while :; do :; done) &
sleep 120
kill %1
kill %2
uptime
# wee, a load of 2, but the CPU is idle

-- 
               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