[Freeswitch-users] interesting mod_erlang_event performance problem

Seven Du dujinfang at gmail.com
Tue Jun 14 17:09:53 MSD 2011


First, i'm running on Mac 10.6.7 with FreeSWITCH Version 1.0.head (git-765908f 2011-05-22 19-10-52 -0500)

I found erlang receives events really slow so I did some tests.

I use two custom erl to receive events, the file is on github:


The only difference of fse.erl and fse2.erl is that the following line in fse.erl was commented (line 16).

{blah, 'freeswitch at localhost'} ! {blah}, % comment this line will be slow

I run the scripts at about the same time, so they should can get the same events. The problem is that fse2.erl runs fast ( 1000 events in 6s ) while fse.erl is slow (1000 events in 2 min).

(s2 at localhost)1> fse2:start().
start {{2011,6,14},{20,21,41}}
end {{2011,6,14},{20,21,47}}

(s at localhost)1> fse:start().
start {{2011,6,14},{20,21,36}}
end {{2011,6,14},{20,23,24}}

It's like fse.erl can only get 10 events per sec, so I guess there's some sleep(100) things in code, but sending a message(what ever) to FS breaks the sleep.

the {blah} message can be anything, while a valid msg can get ok, an invalid one gets {error, undef} etc.

I use the simple shell script to generate many events:


for f in `seq 1 8`; do
for f in `seq 1 20`; do
fs_cli -x "bgapi originate sofia/internal/load_test@$IP:5080 9664"
sleep 2

Seven Du
About: http://about.me/dujinfang
Blog: http://www.dujinfang.com
Proj: http://www.freeswitch.org.cn
Sent with Sparrow
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20110614/c1603552/attachment-0001.html 

More information about the FreeSWITCH-users mailing list