1.CDN Acceleration Principle
Through the dynamic Domain name resolution, the user's request is assigned to the fastest server from itself. The CDN server directly returns the cached file or the content of the original station via the leased line.
Network acceleration + content caching to provide access speed efficiently
Number of 2.CDN nodes
A number of computer rooms, each computer room multiple servers, CDN node generally hundreds of
3.CDN What content is cached
Cache html, images, CSS, XML and other static resources, do not cache contains? The dynamic address, JSP, and Php,js files are not cached "unless special settings"
The cache origin returns an HTTP status of 20* or 304 and does not cache other states (for example, 404,500,503)
Updates to 4.CDN cache content
A) The user first request, the CDN from the original site crawl after the cache, until the file expires after the user request to update again
b) Program proactively notify CDN Crawl
Expiration date of 5.CDN cached content
A) static files from the original station Apache: controlled by Apache's expire and header modules
Two main items: last-modified,cache-control:max-age
Apache default configuration, all static files in CDN cache only 3600s "require us to adjust the Apache settings of the accelerated server as required"
After 3600s CDN fails, the user will re-request the original station, if there is no change, the cache expiration period automatically extend 10%.
b) The original station JSP or PHP spit dynamic content (URL form must be static)
By program control Last-modified,cache-control:max-age Public, Apache settings will not work
CDN based on these two to determine whether to the original site to update content
6.CDN and application combination strategy
A) pages with infrequent changes: example of a picture Display page, model page, closed match page
In the original station generated static pages, the original site Apache defined expiration time, such as 1 days.
You can wait for the CDN to expire after you update the static files on the original station. or proactively notify CDN updates (the cost can be very high as CDN nodes become more and more expensive)
b) frequently changing pages: such as in-time Asian discs in the football library, timely euro compensation, ongoing matches against the page
Do not generate static pages, defined by JSP or PHP expiration time, such as 5s or 60s. After the CDN expires, if there is user access to crawl from the original station.
Advantages: The relevant page content update, do not need to proactively notify 100 of the original station to crawl, effectively reduce the pressure of the original station.
If the page content does not change, return lastmodified unchanged, so that the original station will directly return 304 to CDN,CDN will also return 304 to the user. Reduce network transmission and speed
At the end of the game, the "in-Progress match page" is converted to the first type of case, and then the static file is generated.
c) Special static resources: Comments in the sample library and some large product libraries JS
or frequently accessed, frequently updated pages: For example, a timely score file for a football event library
Via Apache NoCache tells IE not to cache, HTML does not need to use pinglun.js?123456 such code form
Then use the max-age to tell the CDN cache 1s, so that each user request to avoid the transfer to the original station
CDN Cache Policy FAQ