In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces "what is the process of browser cache, DNS,CDN and domain name resolution". In the daily operation, I believe many people have doubts about the process of browser cache, DNS,CDN and domain name resolution. The editor has consulted all kinds of materials and sorted out simple and easy-to-use operation methods, hoping to answer "browser cache, DNS". The confusion of CDN and the process of domain name resolution helps! Next, please follow the editor to study!
Browser caching mechanism
When we refresh a page using the Ctrl+F5 key combination, some request headers are added to the request header of the HTTP
It tells the server that we want to get the latest data instead of caching.
Cache-Control
This HTTP Head field is used to specify the instructions that all caching mechanisms must follow throughout the request / response chain.
Optional values indicate that all Public content will be cached, set Private content in the response header to be cached only in private cache, set no-cache in response header all content will not be cached, set no-store in request header and response header all content will not be cached in cache or Internet temporary file, set must-revalidation/proxy-revalidation in response header if cached content fails The request must be sent to the server / agent for reauthentication. Setting the content of the max-age=xxx cache in the request header will expire after xxx seconds. This option is only available in HTTP 1.1.It has a higher priority when used with Last-Modified and is set in the response header.
The Cache-Control request field is well supported by various browsers, and it has a higher priority.
When it appears at the same time as some other request fields (such as Expires), Cache-Control overwrites the other fields.
Expires
The usual format for Expires is Expires: Sat, 25 Feb 2012 12:22:17 GMT
This is followed by a date and time after which the cached content will be invalidated.
Last-Modidified/Etag
The Last-Modified field is generally used to indicate the last modification time of a resource on a server
Resources can be static (static content is automatically added with Last-Modified fields)
Or dynamic content (for example, Servlet provides a getLastModified method to check whether a dynamic content has been updated)
This last modification time can be used to determine whether the currently requested resource is up-to-date.
Generally, the server returns a Last-Modified bullet in the response header to tell the browser when the page was last modified.
For example, Last-Modified: Sat, 25 Feb 2012 12:55:04 GMT, when the browser requests again
Add an If-Modified-Since: Sat, 25 Feb 2012 12:55:04 GMT field to the request header
Ask if the currently cached page is up-to-date, and if it is up-to-date, return a 304 status code, telling the browser that it is up-to-date and that the server will not transmit new data.
There is also an Etag field that has a similar function to the Last-Modified field
The purpose of this field is to have the server assign a unique number to each page.
Then use this number to distinguish whether the current page is up-to-date.
This approach is more flexible than using Last-Modified, but it is more difficult to deal with when there are multiple back-end Web servers
Because every Web server has to remember all the resources of the website.
Otherwise, it will be meaningless for the browser to return this number.
DNS domain name resolution process
When a user enters www.yisu.com into a browser, DNS parsing will take nearly 10 steps, which is roughly described below.
browser
The browser will check whether there is a resolved IP address corresponding to this domain name in the cache.
If there is one in the cache, the parsing process ends.
The browser cache domain name is also limited, not only the browser cache size is limited, but also the cache time is limited.
It usually ranges from a few minutes to several hours.
The time limit for a domain name to be cached can be set through the TTL property.
Operating system
If it is not in the user's browser cache, the browser will search the operating system cache to see if there is a DNS resolution result for this domain name.
In fact, the operating system also has a process of domain name resolution.
You can set it in Windows through the C:\ Windows\ System32\ drivers\ etc\ hosts file
You can resolve any domain name to any accessible IP address.
In Linux, the configuration file is / etc/hosts
When resolving to a domain name in this configuration file, the operating system caches the resolution result in the cache
The cache time is also controlled by the expiration time of the domain name and the size of the cache space.
Domain name servers in this region
If you still cannot resolve the domain name on this machine, you will actually request the domain name server to resolve the domain name.
We all have the item "DNS server address" in our network configuration
The operating system will set this domain name as the domain name server (LNDS) for the region.
This DNS usually provides you with a DNS resolution service for local Internet access.
For example, if you are connected to the Internet at school, your DNS server must be in your school.
If you are connected to the Internet in a community, then this DNS is provided to you to access the Internet application provider, that is, Telecom or Unicom.
The performance of this special domain name resolution server will be very good, and they will generally cache the results of domain name resolution.
Of course, the cache time is controlled by the expiration time of the domain name.
Root Server domain name server
If LDNS still misses, go directly to the Root Server domain name server to request resolution.
Return the primary domain name server address
The root domain name server returns to the local domain name server a queried primary domain name server (gTLD Server) address.
GTLD is an international top-level domain name server, such as .com, .cn, .org, etc., there are only about 13 in the world.
Send a request to the primary domain name server
The local domain name server (Local DNS Server) then sends a request to the gTLD server returned in the previous step.
Domain name provider's server
The gTLD server that accepts the request finds and returns the address of the Name Server domain name server corresponding to this domain name.
This Name Server is usually the domain name server you registered.
For example, if you apply for a domain name from a domain name server provider, the domain name resolution task will be done by that domain name provider's server.
Mapping relation table
The Name Server domain name server queries the mapping table stored in the domain name and IP
Under normal circumstances, the target IP record is obtained based on the domain name and returned to the DNS Server domain name server with a TTL value.
Local DNS Server caching
Return the IP and TTL values of the domain name. Local DNS Server will cache the corresponding relationship between the domain name and IP.
The time of the cache is controlled by the TTL value.
Local system cach
The resolution result is returned to the user, the user caches it in the local system cache according to the TTL value, and the domain name resolution process ends.
Note: in the actual DNS parsing process, there may be more than these 10 steps
For example, Name Server may have many levels, or there may be a GTM for load balancing control.
All of these may affect the process of domain name resolution.
Several methods of domain name resolution
Domain name resolution records are mainly divided into A records, MX records, CNAME records, NS records, and TXT records.
A record
A stands for Address, which is used to specify the IP address corresponding to the domain name
The A record can resolve multiple domain names to a single IP address, but not one domain name to multiple IP addresses.
MX record
MX means Mail Exchange, which means you can point the mail server under a domain name to your own Mail Server.
DNS sends the message to the server of the MX record, but if it is normally requested through Web, it still resolves to the IP address of the A record.
CNAME record
CNAME is called Canonial Name (alias resolution).
Alias resolution means that one or more aliases can be set for a domain name.
NS record
NS record that specifies a DNS resolution server for a domain name, that is, the domain name is resolved by the DNS server of the specified IP address.
TXT record
Sets a description for a hostname or domain name.
CDN working mechanism
CDN, also known as content Distribution Network (Content Delivery Network), is an advanced traffic distribution network built on the existing Internet.
The aim is to add a new network architecture to the existing Internet
Publish the content of the website to the "edge" of the network closest to the user, so that the user can get the content they need nearby.
Improve the response speed of users visiting the website.
At present, CDN mainly caches the static data in the website, such as CSS,JS, pictures and static pages.
Users first request dynamic content from the master server, and then download these static resources from CDN, so as to accelerate the download speed of web data content.
CDN architecture
A user accesses a static file (such as a CSS file) whose domain name is cdn.jb51.net.
Then the first step is to make a request to the Local DNS server
Generally, after iterative resolution, we go back to the registration server of this domain name to resolve. Generally, every company will have a DNS resolution server.
At this time, the DNS resolution server usually re-CNAME it to another domain name.
And this domain name will eventually be pointed to the DNS load balancer server in the CDN global, and then the GTM will finally assign the local access users.
Return to the CDN node closest to the visiting user.
When you get the DNS resolution result, the user goes directly to the CDN node to access the static resource file.
If the requested file in this node does not exist, it will go back to the origin server to get the file, and then return it to the user.
At this point, the study on "browser caching, DNS,CDN and domain name resolution process" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.