Improve site performance with three types of asp.net cache

Source: Internet
Author: User
Asp. NET provides three main forms of caching: page-level output caching, user control-level output caching (or fragment caching), and caching APIs. The advantage of output caching and fragment caching is that it is very easy to implement, and in most cases it is sufficient to use both types of caching. The caching API provides additional flexibility (which is actually quite a lot of flexibility) and can be used to leverage caching at every level of the application. This paper comprehensively introduces the application of these three kinds of caching techniques in each layer of the system.
Of the many features provided by ASP.net, caching support is certainly the most appreciated feature of mine, and I would say there are good reasons for that. Caching has the greatest potential impact on the performance of an application compared to all other features of ASP.net, and with caching and other mechanisms, asp.net developers can accept the extra overhead of building a site with expensive controls, such as a DataGrid, without having to worry about the impact of performance. To maximize caching in your applications, you should consider ways to implement caching at all program levels.
Steve's Caching Tips
Cache as early as possible;
You should implement caching at every level of your application. Add caching support to the data tier, business logic tier, UI, or output layer. Memory is now very cheap-therefore, a great performance improvement can be achieved by implementing caching in the entire application in an intelligent manner.
Caching can prevent many mistakes
Caching is a way to get "good enough" performance without a lot of time and analysis. Again, the emphasis here memory is now very cheap, so if you can get the performance you need by caching the output for 30 seconds instead of trying to optimize the code or the database for a whole day or even a week, you will definitely choose to cache the solution (assuming you can accept 30 seconds of old data). Caching is one of those features that uses 20% to get 80% returns, so to improve performance, you should think of caching first. However, if the design is bad and the end result is likely to have undesirable consequences, you should, of course, design the application as well as possible. But if you just need to get high enough performance immediately, caching is your best option, and you can redesign your application later when you have time.
Page-Level output caching
As the simplest form of caching, the output cache retains only the copy of the HTML that is sent in response to the request in memory. Subsequent requests will provide cached output until the cache expires, so that performance can be significantly improved (depending on how much overhead is required to create the original page output-the output of the send cache is always fast and relatively stable).
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.