A nice article on PHP Daemon implementation:<br><br><a href="http://www.bbgamedev.net/index.php/writing-a-daemon-in-php/">http://www.bbgamedev.net/index.php/writing-a-daemon-in-php/</a><br><br><div class="gmail_quote">On Wed, Dec 9, 2009 at 11:37 AM, Paolo Mainardi <span dir="ltr"><<a href="mailto:paolomainardi@gmail.com">paolomainardi@gmail.com</a>></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;"><div><div></div><div class="h5"><br><br><div class="gmail_quote">On Wed, Dec 9, 2009 at 9:35 AM, Sascha Grossenbacher <span dir="ltr"><<a href="mailto:saschagros@gmail.com" target="_blank">saschagros@gmail.com</a>></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;">
<div>On Wed, Dec 9, 2009 at 6:57 AM, Larry Garfield <<a href="mailto:larry@garfieldtech.com" target="_blank">larry@garfieldtech.com</a>> wrote:<br>
> It's true that resources like DB connections or file handles don't survive<br>
> serialization. That's why PHP offers the __sleep() and __wakeup() magic<br>
> methods that you can use to control what gets serialized or deserialized if<br>
> necessary. You can find more on them on <a href="http://www.php.net/" target="_blank">http://www.php.net/</a><br>
<br>
</div>Correct. But the main thing an XMPP class does is maintaining a<br>
connection (which is a resource) to the XMPP server. And If I<br>
understood the thread starter correctly, the idea is to avoid the<br>
connection initialization. I'm doing something similiar right now and<br>
in my case, initalizing the connection to the server takes ~40% of the<br>
whole request time. If I have to do that in every __wakeup() call, I<br>
don't gain anything.<br>
</blockquote></div><br></div></div>I think that best solution in this case, is to have a background process in charge of managing XMPP related jobs, avoiding to create for each request a new XMPP environment. <br><br>Ex:<br>
Request ---> Drupal <--socket--> XMPP Server (background process)<br><font color="#888888">
<br><br><br><br clear="all"><br>-- <br>Paolo Mainardi<br><br>CTO Twinbit<br>Blog: <a href="http://www.paolomainardi.com" target="_blank">http://www.paolomainardi.com</a><br><br>-- Please consider the environment before printing this email --<br>
</font></blockquote></div><br><br clear="all"><br>-- <br>Paolo Mainardi<br><br>CTO Twinbit<br>Blog: <a href="http://www.paolomainardi.com">http://www.paolomainardi.com</a><br><br>-- Please consider the environment before printing this email --<br>