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
Persistent Objects
Moderator: General Moderators
- AbraCadaver
- DevNet Master
- Posts: 2572
- Joined: Mon Feb 24, 2003 10:12 am
- Location: The Republic of Texas
- Contact:
Re: Persistent Objects
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?
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?
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Re: Persistent Objects
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
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.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?