What to cache?

K J sanbat at gmail.com
Mon Jul 30 04:43:35 UTC 2007


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.

I'm looking to cache things like, "recently logged in members", or "latest
blog posts".  Would it be best to use Smarty for this? Or Memcache?  With
Memcache, all web servers will be able to obtain the same data, whereas with
Smarty, each web server would have to cache its own.

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.

I'm not understanding you here. Do you mean, it can speed things up a lot if
I cache the end result HTML portion in Memcache?


On 7/30/07, Rob Sharp <rob.sharp at thesoundalliance.net> wrote:

> 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.
>
> Thanks,
> Rob.
>
>     *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/25f0e234/attachment.htm


More information about the memcached mailing list