views:

92

answers:

2

I have a blog built using Zend Framework, which I realize might be a bit overkill for a blog alone, but I am planning on adding other features in the future. Nevertheless, I've noticed pages could be a little speedier. I've done a basic caching method that basically captures everything in index.php (Core frontend and File backend), which works great, but unfortunately it also prevents dynamic page contents from updating (messages like "this was posted 5 minutes ago", etc) until the cache period expires.

So my question is what would be the best method of caching to improve performance? I am doing fairly basic queries which are mostly simple selects, not many joins or anything fancy (using Zend_Db_Table), and even on a small database page loads are a little sluggish. Is it worth it to cache queries or should I focus my time elsewhere?

+1  A: 

To enable the kind of dynamic-ness of your rendering ("posted X minutes ago"), you could push the caching a bit further upstream. Don't cache the html output, just cache the data returned from the query. Then your rendering code still has access to the date posted data and your rendering code can use it.

Of course, @zerkms is right. Profiling is necessary to identify the bottlenecks.

David Weinraub
A: 

Caching may be implemented in the future if current performance is satisfying. My advices would be:

  • optimize frontend first (compress CSS, JS, merge into one file, avoid multiple requests, see Yahoo rules for performance)
  • use opcode cache
  • there is already Page backend in ZF for caching the whole pages (you set it up in index.php)
  • if above is not enough, profile your app (e.g. using ZFDebug), and see what's the problem. Then choose right tool for the job.
  • see my answer for Zend_Cache_Backend_Sqlite vs Zend_Cache_Backend_File
takeshin