[asterisk-users] Really Big Queues

Steve Edwards asterisk.org at sedwards.com
Tue Jan 16 20:47:53 MST 2007


On Tue, 16 Jan 2007, Christopher Snell wrote:

> Idea #1:   Use servers with (2) Digium 4-port PRI cards, running
> Asterisk, as media gateways.  From here, send calls to 2 or more
> Asterisk queue servers.  For each incoming call, run an AGI on the
> media gateways that determines which queue server is least loaded.
> Send this incoming call to the queue server over an IAX2 trunk.  The
> problem with this method is that the queues are not unified; if one
> queue server suddenly has available agents, queued callers on the
> other queue server cannot be (easily?) transfered to the server with
> available agents.  Also, running an AGI for each incoming call is lame
> and slow.

This is similar to what I am doing now.

I have 3 1u's with a single Digium 4 port PRI card. Each server services 2 
T1's. This configuration was based on management's tolerance for in-flight 
call revenue loss, not CPU capacity. The "telco servers" dial a single 
application server via IAX.

I disagree with "lame and slow."

In my system, 3 AGI's are executed on the telco servers before the call is 
"handed over" to the application server and 1 more when the call is hung 
up.

8 AGI's are executed on the application server before the caller connects 
to the product of their choice and 2 more when the call is hung up.

All of the boxes are 3 gHz Intel's. This system handles a load of about 
15,000 calls a day with about 100 simultaneous callers and based on "top" 
could handle several times that load -- most of the boxes run about 80%+ 
idle.

Just for grins, I wrote an AGI (in C, like all my AGI's) that just reads 
the AGI environment from STDIN, parses it, and stuff's the strings into a 
structure, just like any "real" AGI would and then exits. I find that a 3 
gHz non-HT Intel can execute about 300 "noop" AGI's per second.

For comparison, this same box can execute the "noop" application about 
6,000 times per second. This is not to say that an application executes 20 
times faster than an AGI, just that the invocation of an AGI is much more 
"expensive" than an application because it is a separate process and 
communicates with Asterisk via STDIN/STDOUT. Once the AGI is started, I 
believe the execution time of the "meat" of the AGI should be similar to 
that of an application.

AGI's:

) don't crash Asterisk if you make a simple coding error.

) "take effect" as soon as you move them to the agi-bin directory.

) never require a reload or a restart.

) can be coded in a variety of languages by programmers with meager coding 
skills.

) are less complex because they only have to deal with a single thread of 
execution.

) are quicker to develop.

AGI's rock and are appropriate for many applications.

Thanks in advance,
------------------------------------------------------------------------
Steve Edwards      sedwards at sedwards.com      Voice: +1-760-468-3867 PST
Newline                                             Fax: +1-760-731-3000


More information about the asterisk-users mailing list