Caching is one of the best techniques you can use to improve the application performance. you need to design in such a way that can improve the performance.
Where to cache:
When data being cached in persentation layer consider when it needs to be displayed and make sure the data is not cached on per-user level. For example, displaying list of countries in a dropdown, you can look these up once from the database and then store them in the cache.
When data being cached in business logic level, you can use system applicaple data structures like hashtable or arraylist. Consider caching in the business layer when the data cannot be efficiently retrieved from the database. Data that changes frequently should not be cached.
Cache in database, when large amount of data is cached and also when it is needed to cache for a very long period. Here, the data is cached in temporary tables which may consume more memory. Make sure caching in database is improving or hurting the application performance.
Choose the cache location, depending on the scope of the cached object. If you need to cache data for lengthy periods of time, you should use a SQL Server database. For shorter cache durations, use in-memory caches.
what to cache: Do not cache per-user data, which may cause consume more memory, ex. caching a site level search results for every user. that's costly.
Cache frequently used, not frequently changing, data. It's of no use caching a frequently changing data.
Do Not cache shared resources like database or network connections, instead you can pool it. Make all your changes to the data, before caching it.
# Happy Coder #
|
No responses found. Be the first to respond and make money from revenue sharing program.
|