Forking process on every incoming event is terrible idea IMO. Threads are more lightweight than processes.<br>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.<br>
<br>There is one SocketReader thread and several Worker threads in a thread pool.<br><br>&quot;SocketReader&quot; 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.<br>
<br>-Vladimir Rodionov<br><br><br><br><div class="gmail_quote">On Fri, Aug 7, 2009 at 5:23 PM, Nicolas Brenner <span dir="ltr">&lt;<a href="mailto:nicolas@medularis.com">nicolas@medularis.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
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/).<br>

<br>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.<br><br>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 &quot;catches&quot; an event on the socket.<br>

<br>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&#39;t miss any events? should there be more than one daemon? ... any tips and recommendations are welcome.<br>

<br>Thanks!<br><font color="#888888"><br>Nicolas<br>
</font><br>_______________________________________________<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br>