[Asterisk-Dev] PHP vs C

Kenneth Shaw ken at expitrans.com
Mon Nov 1 10:40:29 MST 2004


PHP.

Use an Optimizer/Cacher like Turck MM Cache. This is essentially
compiling to byte code, and then running the PHP code.

PHP Has tons of benefits, similar to the benefits of using Java, Python
or similar. The great benefit of PHP, we've found is its easy
integration with web services, which can't be beat. Surprisingly, PHP
won't slow down your system that much in terms of call connect time.
This of course is dependent on how many simul. connections you're
expecting. 

What you can always do is do some kind of load balancing, if it becomes
an issue. In terms of cost, the extra hardware is more cost effective
than your developer's time would be. Estimate the amount of hours it
would take you to implement something in PHP/Java/Python/Whatever vs.
Standard C, and you'll probably realize that the "inefficiency" is a
good enough tradeoff. 

Currently, we're using nothing but PHP internally for our call agents.
They interact with a web based custom CRM solution, and the optimized
call routing is determined by our CRM libs, not by Asterisk. At peak, we
get maybe 2-3 connections per second, which handled across two 2.8 ghz
machines (one is DB/Web, the other is an Asterisk server), we are never
bogged down.

Developing a nice little LCR system for Asterisk would be nice, and we'd
use if it you cared to develop it, but there's no real necessity to
develop it. 


On Mon, 2004-11-01 at 11:20 -0600, Matthew Boehm wrote:
> Hey guys,
>  I'm getting ready to write a custom least cost routing app for our company
> and wanted to get some pro/con feedback on programming this app  a) in PHP
> as an AGI  or  b) in C as a loadable .so module
> 
>  Would be nice if I could compile PHP code into a module but you can't
> compile PHP code (at least, I've never seen it).
> 
> This app will be used on every call made thru the server so it needs to be
> fast and low cpu intensive. It will be accessing mysql and running at least
> 2 queries each execution.
> 
>  I have no preference on the language. I am confident that I can program it
> in either, but I would rather choose the better language for this paticular
> case (ie, speed).
> 
> Thanks,
> Matthew
> 
> _______________________________________________
> Asterisk-Dev mailing list
> Asterisk-Dev at lists.digium.com
> http://lists.digium.com/mailman/listinfo/asterisk-dev
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-dev
> 
-- 
Kenneth Shaw <ken at expitrans.com>
ExpiTrans, Inc.




More information about the asterisk-dev mailing list