Improve site performance with three caches of ASP. NET

Source: Internet
Author: User

ASP. NET provides three main forms of cache: page-level output cache, user control-level output cache (or segment cache), and cache API. The advantage of output cache and fragment cache is that it is very easy to implement. In most cases, it is sufficient to use these two caches. The cache API provides additional flexibility (in fact, it is quite flexible) and can be used to exploit the cache at each layer of the application. This article comprehensively introduces the application of these three caching technologies in all layers of the system.
Among the many features provided by ASP. NET, cache support is undoubtedly my favorite feature. I have a good reason to say so. Compared with ASP. all other features of. NET, the cache has the greatest potential impact on the application performance, using the cache and other mechanisms, ASP. NET developers can accept the additional overhead when building a site using a control with a large overhead (for example, DataGrid), without worrying that the performance will be greatly affected. To maximize the use of caching in applications, you should consider implementing caching at all program levels.
Steve's cache prompt
Early cache; frequent Cache
You should implement caching at each layer of the application. Add cache support to the data layer, business logic layer, UI, or output layer. Memory is currently very cheap-therefore, implementing caching in the entire application in a smart way can greatly improve performance.
Cache can prevent many mistakes
Caching is a way to achieve "good enough" performance without much time and analysis. The memory is very cheap now, so if you can cache the output for 30 seconds, instead of spending a whole day or even a week trying to optimize the code or database to get the required performance, you will definitely choose a cache solution (assuming you can accept 30 seconds of old data ). Cache is one of the features that get a 20% return Using 80%. Therefore, to improve performance, you should first think of cache. However, if the design is poor, it may lead to adverse consequences. Therefore, you should, of course, try to design the application correctly. However, if you only need to obtain high performance immediately, the cache is your best choice. You can redesign the application in the future.
Page-level output Cache
As the simplest form of caching, the output cache only retains the HTML copies sent in response to the request in the memory. When there are other requests, the cache output will be provided until the cache expires. In this way, performance may be greatly improved (depending on the overhead required to create the original page output-the output of the sending cache is always fast and 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.