开发者

ASP.NET caching my page how do i measure how well it works?

Im getting to where i need to consider caching for my web application. Im a bit courious as to how long time 开发者_如何学Pythoni should cache the items, so i would like to make some sorts of statistics on how often i use my cache vs how often i load data from my server. How to go about doing this? Should i do this manually with data caching, like this:

  1. Does the data exist in my cache
    1. No - load it into cache and return it
      1. Insert a row into my database for statistics
    2. Yes - use the data from the cache
      1. Insert a row into my database for statistics

To me it seems a bit odd to query the cache and then insert into my database, seems the performance gain is lost then - right? What to do then?


Instead of looking at this problem as a sitewide problem, I would investigate those areas that are bottlenecks in your system, and consider caching those. The time you cache will depend on the data, and how frequently it changes.

Asp.net has some built in performance tools that will show you quite a bit of information about your cache

http://msdn.microsoft.com/en-us/library/ms972959.aspx

Don't focus on the cache hits vs. misses. Start off by focusing on the data that is retrieved often, but changes very little.

This article has some good information on implementing a caching policy

http://www.c-sharpcorner.com/UploadFile/vishnuprasad2005/ImplementingCachinginASP.NET11302005072210AM/ImplementingCachinginASP.NET.aspx


I would agree with Aaron. Why do you want to introduce caching? What problem are you trying to resolve? Are you having performance problems and are they directly related to database reads?

I have implemented ASP.Net/SQL caching on numerous projects and have found that the bottlenecks usually lie elsewhere i.e. page size.

I hope this helps.

B

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜