Page 1 of 1

Objects stored in shmop

Posted: Thu May 10, 2007 12:01 pm
by alex.barylski
I am developing a system for maintaining dedicated servers. I use a common code base for many of the operations. I'm wondering, is it possible to store common PHP objects in shared memory so they don't have to be re-created on each request and I can avoid using serialization.

Not sure how much sense that makes as each PHP request would initialize the object again, but i'm wondering if using a conditional to determine if the object is loaded and not including it's classes might be a step in the right direction?

Anyone ever try anything like this before to cut down on parsing, etc?

I'm looking into PHP caching engines as well, but I still think that common objects would make sense stored in shmop?

Cheers :)

Posted: Thu May 10, 2007 3:40 pm
by Begby
I don't know if this is possible, if it was it would most certainly involve some sort of crazy hacks/work arounds and stuff. Since PHP was never designed with persistence in mind I don't think pursuing shared instances of objects is a good idea.

How much parsing is happening? What else have you tried to do to reduce parsing? Is the parsing causing that much of a slowdown?

If persistence is a necessity then you may want to consider another solution such as java. One developer I know got so fed up with some SQL Server / PHP issues that he coded his model into a set of .NET webservices with persistent objects then used those in conjuction with PHP for the presentation. It actually has worked really well for him.