Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the right info to cache? What's a good page load time?

I'm in the process of developing a social network site.

And been thinking of scalability from day one of the project, I've fine tuned the site and queries to the best of my ability.

However; Certain pages are very data heavy and I'm not quite sure if they are loading as fast as they could so I was thinking of implementing a distributed caching solution.

But not quite sure what I should cache and not cache. Or if current page load times of 1 second is good or bad.

The heaviest query is grabbing member information this query gets all the member's info and anything related to them such as in this site's case their goals, blog type entries, encouragements, photos, status updates (like twitter), blog info (for crossposting their entries) etc etc.

Anyhow, should I cache this info? And do you think 1 second page load times are reasonably fast? Some pages are less than a second between 4-6 10ths of a second.

like image 555
dswatik Avatar asked Oct 20 '08 15:10

dswatik


1 Answers

I'd implement caching at each and every layer of your application if at all possible.

You can cache pages at the highest level, objects at the code level, and ensure your database is caching both queries and key data correctly at the lowest level.

In terms of WHAT you need to cache, any objects that will be repeadedly accessed should be cached, especially those which are unlikely to change very often. You can then reset that object's cache only when it is edited. ( Be cautious of caching objects which are frequently updated as a constant cycle of replacing the cache on almost every load will degrade performance instead of enhancing it)

For measuring performance, I'd not look at how long a single page takes to load, but google for some performance measuring tools as you really need to test how fast each page performs under pressure. Your user info page might not be the biggest caching target if it is rarely accessed for example. You should be focussing on the most heavily used pages.

like image 187
Matthew Rathbone Avatar answered Oct 14 '22 12:10

Matthew Rathbone