Page 1 of 1

Persistent Objects

Posted: Wed Jul 14, 2010 11:48 am
by jcobban
On my web site I am working with a genealogical database. Since that database must map the complexities of real world relationships it has a very large number of tables, many of which must be queried in order to create the web page. The performance therefore sucks. I would like to be able to avoid repeating queries by storing the responses in server level persistent objects. Session level objects are inefficient because the information in the database is shared with all users.

I am also concerned because PHP insists upon serializing my session level objects, presumably so it can store them externally. But that would defeat the purpose. I just want these objects to persist in server memory, so that I do not have to repeat the queries.

For an example of the performance problems I am encountering, try http://www.jamescobban.net/FamilyTree/l ... p?id=12789

Re: Persistent Objects

Posted: Wed Jul 14, 2010 12:21 pm
by AbraCadaver
Have a look at APC http://us2.php.net/manual/en/book.apc.php and Memcache http://us2.php.net/manual/en/book.memcache.php

You could also just store these result objects in a db table with a unique key to access. You would of course need to serialize the object, but I don't see how that defeats the purpose?

Re: Persistent Objects

Posted: Wed Jul 14, 2010 1:27 pm
by John Cartwright
I would make sure all your queries/tables are optimized very carefully before you start dwindling in persistant objects. From the page you supplied, it doesn't seem like it should be resource intensive..

Re: Persistent Objects

Posted: Fri Jul 16, 2010 9:33 am
by jcobban
AbraCadaver wrote:Have a look at APC http://us2.php.net/manual/en/book.apc.php and Memcache http://us2.php.net/manual/en/book.memcache.php

You could also just store these result objects in a db table with a unique key to access. You would of course need to serialize the object, but I don't see how that defeats the purpose?
The problem is that the performance is unacceptable if I have to retrieve the information from the database every time I wish to display it to a user.