[Case discussion] from the case-related thoughts on cache design, we will never be confused

Source: Internet
Author: User

Theme: Thinking about cache design caused by case studies

Background:When talking about performance optimization, it is necessary to talk about the design and use of the Cache architecture. Almost everyone knows the power of caching, but they only know how to use it properly in their own projects. Our team has optimized the performance and architecture for projects of many companies and encountered many problems caused by misuse and misuse of the cache. the cache of these projects not only didn't prompt the performance, it becomes a performance bottleneck.

The usage of cache is inconclusive. There is no such thing as "yes, you must wait for XXX". Without such a golden rule, everything is "determined based on the actual situation of the project". However, this is not the case we have seen. We have also asked a lot of people to answer questions, which surprised us: "This is what we use online. XXX Should Be like this ". Mechanical copying, without the blind mind, can be imagined. Our discussion here is a real discussion of dry goods. We will give some common strategies and scenarios. You can use them based on the situation, hoping to "authorize them to fish" instead of making them happen.

 Outline:
In different projects, where do you think the cache can be used, for example. Take a Web project as an example)
What is the caching policy?
How to design intelligent caching
Performance problems caused by cached data and different data
Common cache errors of the Supervisor

Let's get started first. You can join us!
First, let's talk about the areas where cache can be used in projects.

I can use a picture here to make it clearer!

650) this. width = 650; "id =" aimg_533316 "class = zoom title =" 20120517095429.png" alt = "20120517095429.png" src =" http://www.bkjia.com/uploads/allimg/131228/1J1095G7-0.png "width =" 700 "/> since we talk about caching, so let's talk about this topic in a more detailed manner, because many people talk about big hats in a lot of cases, but as soon as we get to the real details and implementation, many people will get stuck, it's a bit like "blow up, the world is invincible; do it, nothing.

First, let's look at the browser cache.
As you may know, this setting is mainly implemented by setting the Response Header "Cache-Control", as shown below:
650) this. width = 650; "id =" aimg_533317 "class = zoom title =" 20120517100234.png" alt = "20120517100234.png" src =" http://www.bkjia.com/uploads/allimg/131228/1J1093L9-1.png "width =" 484 "/> 2012-05-17 uploadDownload Attachment(16.76 KB)

Different technical platforms are implemented in different ways. Don't worry about the differences between these platforms. As long as the final result is the same, it's okay to look at each technology with an inclusive mind, if the difference in technology cannot be tolerated, it may not be too stingy.

For example, Microsoft's ASP. NET can be implemented in several ways:
1. Set in the page as follows:
650) this. width = 650; "id =" aimg_533318 "class = zoom title =" 20120517100540.png" alt = "20120517100540.png" src =" http://www.bkjia.com/uploads/allimg/131228/1J1092M6-2.png "width =" 675 "/>

2. Set in the Code as follows:
650) this. width = 650; "id =" aimg_533319 "class = zoom title =" 20120517100619.png" alt = "20120517100619.png" src =" http://www.bkjia.com/uploads/allimg/131228/1J1095257-3.png "width =" 683 "/>

3. Set in IIS as follows:
650) this. width = 650; "id =" aimg_533320 "class = zoom title =" 20120517100705.png" alt = "20120517100705.png" src =" http://www.bkjia.com/uploads/allimg/131228/1J10911A-4.png "width =" 700 "/> the browser cache can cache pictures, js and css. Of course, some data can be stored in the browser in the form of js objects.

The main problem with browser cache is the update of images, js, and css.

For example, if we set the cache time to one month, these resources will probably be updated because we have released a new version. At this time, the browser will still use the old version.
This is not what we want to see, the solution is also very simple, if you pay attention to, it will find a lot of site js, css is named like this: XXX-1.2.js

This allows the browser to re-download new resources through version control. Too much content, please refer to: http://www.agilesharp.com/Forum.aspx/t-17

This article is from the "Yan Yang Tian" blog, please be sure to keep this source http://yanyangtian.blog.51cto.com/2310974/867512

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.