Sponsor: VoiceMeUp - Corporate & Wholesale VoIP Services

VoIP Mailing List Archives
Mailing list archives for the VoIP community
 SearchSearch 

[Freeswitch-users] Best practices / tips for Event socket daemon


 
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> freeSWITCH Users
View previous topic :: View next topic  
Author Message
nicolas at medularis.com
Guest





PostPosted: Fri Aug 07, 2009 7:30 pm    Post subject: [Freeswitch-users] Best practices / tips for Event socket da Reply with quote

Hi, I built an event socket daemon that waits for certain events, when it receives those events, it does some processing and keeps waiting for more events. The daemon is written on PHP and uses a slightly modified version of fs_sock.php (from contrib/intralanman/PHP/fs_sock/).

What I am doing / what I want to do: I am generating calls and bridging them using a JS script. Then the daemon logs the info about the calls and keeps track of their status in a database.

The problem is: the daemon is apparently missing out on some events, and I think it is because of the processing/updating on the DB it has to do each time it "catches" an event on the socket.

My question is: which language would you recommend for the task, and how would you go about handling events? Should the dameon fork a process for each event it receives so that it doesn't miss any events? should there be more than one daemon? ... any tips and recommendations are welcome.

Thanks!

Nicolas
Back to top
vladrodionov at gmail.com
Guest





PostPosted: Fri Aug 07, 2009 9:46 pm    Post subject: [Freeswitch-users] Best practices / tips for Event socket da Reply with quote

Forking process on every incoming event is terrible idea IMO. Threads are more lightweight than processes.
Can you use threads in PHP? I am not familiar with PHP (Java developer myself).  I can explain how I would implement it in Java.

There is one SocketReader thread and several Worker threads in a thread pool.

"SocketReader" thread - reads data (events) from socket. When event arrives SocketReader checks thread pool, get one Worker (if any) and makes it to process event. If there no available Workers in a pool then event goes directly to a EventQueue. When Worker finishes it checks EventQueue and if there are no events in a queue Worker goes back to thread pool, otherwise it process event from queue.

-Vladimir Rodionov



On Fri, Aug 7, 2009 at 5:23 PM, Nicolas Brenner <nicolas@medularis.com (nicolas@medularis.com)> wrote:
Quote:
Hi, I built an event socket daemon that waits for certain events, when it receives those events, it does some processing and keeps waiting for more events. The daemon is written on PHP and uses a slightly modified version of fs_sock.php (from contrib/intralanman/PHP/fs_sock/).

What I am doing / what I want to do: I am generating calls and bridging them using a JS script. Then the daemon logs the info about the calls and keeps track of their status in a database.

The problem is: the daemon is apparently missing out on some events, and I think it is because of the processing/updating on the DB it has to do each time it "catches" an event on the socket.

My question is: which language would you recommend for the task, and how would you go about handling events? Should the dameon fork a process for each event it receives so that it doesn't miss any events? should there be more than one daemon? ... any tips and recommendations are welcome.

Thanks!

Nicolas

_______________________________________________
FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org (FreeSWITCH-users@lists.freeswitch.org)
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org

Back to top
Display posts from previous:   
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> freeSWITCH Users All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group

VoiceMeUp - Corporate & Wholesale VoIP Services