[asterisk-users] Billing/Call Control engine : AGI scripts/ AstMan API
Steve Edwards
asterisk.org at sedwards.com
Wed Nov 28 00:15:58 CST 2007
On Wed, 28 Nov 2007, Benjamin Jacob wrote:
> The AGI scripts have been written in PHP, using MySQL for the billing
> and profile information.
> The major disadvantages I see using AGI scripts :
> 1. A new process(invocation of PHP scripts) on every new call.
I write all of my AGIs in C. While PHP is PDF (pretty darn fast), it
cannot compare to C.
> 2. MySQL connections on every instance of the PHP AGI script. (I am not
> too sure, if connections can be maintained across processes, am no PHP
> guru. I think, if I write in C/C++ can use shared memory for maintaining
> the connection).
When a process exits, all files, sockets, pipes, etc. are closed. You
cannot maintain a connection across processes.
> Any ideas anyone?or any similar experiences, in terms of performance,
> scalability, etc. w.r.t both AGI scripts and AstMan API?
I wrote a chat system that handles about 15,000 calls a day, peaking at
about 100 simultaneous calls. About 90% of the calls execute 6 AGIs, the
other 10% range from 10 to 50 AGIs. One of the AGIs is even muti-threaded
-- 1 thread plays "please wait while..." as another thread authorizes
their credit card. By the time the sound file has finished I know if the
card is good or not.
AGIs get a bad rap for performance, but I think that is largely due to
AGIs written in scripting languages. The 1.6gHz Celeron ("whit-whoo") I'm
working on right now, will execute over 100 AGIs per second. (The
"null-agi" I just cobbled up reads the AGI environment variables and then
exits.)
If performance actually becomes a problem, you can re-code your
application as an Asterisk application. Then you skip the cost of process
creation and can maintain state and connections.
The same slug used above will execute over 1,000 NOOPs per second.
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