On Wed, Dec 9, 2009 at 9:35 AM, Sascha Grossenbacher <saschagros@gmail.com> wrote:
On Wed, Dec 9, 2009 at 6:57 AM, Larry Garfield <larry@garfieldtech.com> wrote:
> It's true that resources like DB connections or file handles don't survive
> serialization.  That's why PHP offers the __sleep() and __wakeup() magic
> methods that you can use to control what gets serialized or deserialized if
> necessary.  You can find more on them on http://www.php.net/

Correct. But the main thing an XMPP class does is maintaining a
connection (which is a resource) to the XMPP server. And If I
understood the thread starter correctly, the idea is to avoid the
connection initialization. I'm doing something similiar right now and
in my case, initalizing the connection to the server takes ~40% of the
whole request time. If I have to do that in every __wakeup() call, I
don't gain anything.

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.

Ex:
Request ---> Drupal <--socket--> XMPP Server (background process)





--
Paolo Mainardi

CTO Twinbit
Blog: http://www.paolomainardi.com

-- Please consider the environment before printing this email --