W dniu 13 marca 2011 20:20 u¿ytkownik Mateusz Bartczak
> Hi All
> I'm processing Yate events in single PHP script. I handle user.auth,
> call.route, cdr, connect/hangup events. During high load PHP script has a
> lot of events to process and I experience problems with stability.
> I catch events in the following manner:
> In extmodule.conf in I have one entry:
> As far as I understand - when single message handler is running everything
> is blocked until handler returns something. So, for example - one single
> lagging SQL query running for few seconds blocks other messages from being
> processed. Am I correct? What Yate does with events that my script is unable
> to handle because it's busy?
Thread that sent the message is waiting for response from your script.
Other yate threads send messages to your script and also block waiting
for response from your script even if they could have been handled
quickly. As a result one slow query can block all Yate. You can limit
the time that yate threads wait for response from external scripts but
that will result in unhandled messages.
> What's the recommended strategy of splitting events so they could be handled
> by multiple threads?
> I'm only PHP programmer and I know that PHP is single threaded. If there are
> some special methods of doing this in PHP it will be great if you could
> share your tips with me.
> Is it good to divide the one big script into parts and handle each event by
> different script?
Beside solutions already mentioned by Monica you can also start
several instances of one global script. But it will help just until
all instances are busy with heavy query.
In the long run you should consider switching software stack I am afraid.
If you want to try python and yaypm I can give you a hand.