views:

168

answers:

2

What are the advantages and disadvantages of using caching in an asp.net application?

A: 

http://msdn.microsoft.com/en-us/library/xsbfdd8c%28VS.71%29.aspx

Advantage: performances Disadvantage: new data is not displayed immediately

Pierre 303
A: 

Answers will vary based on Environments and Technology.

Advantages

  • Reduce load on Web Services/ Database
  • Increase Performance
  • Reliability (Assuming db backed cache. Server goes down and db is backed by cache there is no time wasted to repopulate an in memory cache)

Disadvantages

  • Could run into issues syncing caches
  • Increased Maintenance
  • Scalability Issues

With great power comes great responsibility ;). We ran into an issue where we decided to use the HttpContext.Cache (bad idea) in an application that was distributed. Early on in the project someone deemed to just throw it in there and we didn't run into issues until we went live. Whenever it comes to caching you need to look at the big picture. Ask yourself do we have enough Data, enough Users, or a performance requirement that warrants implementing caching?

If you answer yes then you are probably going to need a farm of servers so choose your caching provider wisely.

With all that being said, Microsoft has a new cache API AppFabric/Velocity that you could leverage that handles the distribution and syncing of the cache auto-magically.

AppFabric caching allows you to do time out eviction, or even built in notification eviction, so as your data chances the caching server takes not of it and periodically the cache client checks in with the server and gets a list of stuff it needs to sync.

Nix