What to cache?

Rob Sharp rob.sharp at thesoundalliance.net
Mon Jul 30 04:09:36 UTC 2007

On Mon, 2007-07-30 at 11:44 +0800, K J wrote:

> There are portions of my PHP application that updates every 5 minutes
> or so.  Thus I think it's a great candidate for caching, as opposed to
> having the server refresh that portion every time there's a query.

Yes, there's huge benefits to be gained from it.

> As far as I'm aware, there isn't a PHP partial page caching available
> is there?  

Using an engine such as Smarty (smarty.php.net) gives you more granular
control of caching page elements, but I'm not exactly sure what you want
to cache.

> So, I'm thinking of using Memcache instead.  Now, I can cache the SQL
> queries, or I can cach that portion of the page (with html rendered).
> However, if caching that portion, it would mean more internal LAN
> traffic for every page view request.

Often SQL query caching isn't hugely beneficial as your database server
most likely caches pretty well. Caching HTML portions to reduce database
queries will most likely give you a huge performance benefit.

Do you currently have issues with LAN traffic that make you think using
memcache will be a problem? You need to move a lot of data around to
saturate a gigbit switch.

You may also consider a sole memcache instance per web server, whereby
traffic would not leave the server, which may help if you have network
saturation issues.


Rob Sharp
Development Lead 

telephone: 02 9282 4049
facsimile: 02 9282 4099
skype: qu4nnum

Sound Alliance 
inthemix : FasterLouder : Thought By Them : SameSame

100% recycled electrons were used for the composition of this email 
- please don't print it unless you need to!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.danga.com/pipermail/memcached/attachments/20070730/6642d726/attachment.html

More information about the memcached mailing list