[asterisk-users] need examples of asterisk and mysql integration
Tzafrir Cohen
tzafrir.cohen at xorcom.com
Wed Apr 23 15:32:13 CDT 2008
On Wed, Apr 23, 2008 at 03:29:47PM -0400, Mike Trest - On Travel wrote:
> At 02:58 PM 4/23/2008, you wrote:
> Re performance hit.
>
>
> I actually re-wrote one of my frequently used AGI in "C" and even set
> the STICKEY-BIT to avoid reloading the static text portions.
Doesn't Linux ignore the sticky bit?
>
> I noticed slightly lower disk activity level (but the perl file was
> probably in memory cache too). So keeping it memory resident with
> stickey-bit probably was not really needed. But I did see a drop in
> over-all memory usage. Alas, none of these 'savings' were big
> enough to matter.
There's a difference between C and a dynamic language engine (such as
perl and PHP).
To give you some idea of that, let's look at some "do nothing" loops.
# For a base line: pure internal shell:
$ cnt_list=`seq 100`; time ( for i in $cnt_list; do :; done )
real 0m0.001s
user 0m0.000s
sys 0m0.000s
# What happens if I run a subshell?
$ cnt_list=`seq 100`; time ( for i in $cnt_list; do (:); done )
real 0m0.240s
user 0m0.036s
sys 0m0.204s
# Now a small C program:
$ cnt_list=`seq 100`; time ( for i in $cnt_list; do /bin/true; done )
real 0m0.272s
user 0m0.052s
sys 0m0.216s
Slightly worse.
Now a very minimal perl script:
$ cnt_list=`seq 100`; time ( for i in $cnt_list; do perl -e ''; done )
real 0m0.570s
user 0m0.220s
sys 0m0.352s
# Not so bad, right? But it didn't actually have to compile anything.
# Let's give it something to compile:
$ cnt_list=`seq 100`; time ( for i in $cnt_list; do perl -MCGI -e ''; done
)
real 0m4.447s
user 0m2.884s
sys 0m1.564s
# Likewise PHP5
$ cnt_list=`seq 100`; time ( for i in $cnt_list; do php5 -r ''; done )
real 0m3.241s
user 0m1.524s
sys 0m1.716s
# Python:
$ cnt_list=`seq 100`; time ( for i in $cnt_list; do python -c ''; done )
real 0m2.618s
user 0m1.684s
sys 0m0.932s
As you can see, each of them used way more than one second of pure CPU
time for 100 runs (except the C one, and the perl-without-modules one).
And this is with very optimal caching and such.
My system is not top of the line:
processor : 0
vendor_id : AuthenticAMD
cpu family : 15
model : 44
model name : AMD Sempron(tm) Processor 2600+
stepping : 2
cpu MHz : 1599.856
cache size : 128 KB
fpu : yes
fpu_exception : yes
cpuid level : 1
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge
mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx mmxext fxsr_opt
lm 3dnowext 3dnow up pni lahf_lm
bogomips : 3203.56
TLB size : 1024 4K pages
clflush size : 64
cache_alignment : 64
address sizes : 40 bits physical, 48 bits virtual
power management: ts ttp tm stc
Kernel: Linux frenkel 2.6.22-3-amd64 #1 SMP Tue Feb 12 09:22:35 UTC 2008
x86_64 GNU/Linux
--
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