What is the best practice in caching? What are the limits?

418 Views Asked by At

Im using Zend_cache to cache results of some complicated db queries, services etc.

My site is social, that means that there is a lot of user interaction.

Im able to cache users data here and there as well. But taht means, that i will have nearly tens of thousands cache files (with 10 000 users). Is this approach to cache almost everything coming from db still good for performance? Or there are some limits of filesystem?

Was looking for some article around, didnt find.

Thanks for an advice! Jaroušek

1

There are 1 best solutions below

0
On

The question you should be asking is if the overhead of creating/populating/maintaining that cache exceeds the cost of generating the cacheable data in the first place.

If it costs you $1 to generate some data, $10 to cache it, and $0.8 to retrieve from cache, then you'd have to be able to retrieve that data from cache 50 times to break even.

If you only access the cached data 10 times before it expires/invalidates, then you're losing $8.