Objects stored in shmop

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Objects stored in shmop

Post 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 :)
Begby
Forum Regular
Posts: 575
Joined: Wed Dec 13, 2006 10:28 am

Post 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.
Post Reply