Ashamed, a long time ago was interviewed when the interviewer asked me this question, but the answer was very dissatisfied, so looked back a lot of information, now also tidy up.
It can be summarized in the following steps:
1. DNS resolution.
2. TCP link.
3. Send an HTTP request.
4. The server processes and returns an HTTP request.
5. Browser rendering interface.
6. End of connection
A DNS resolution
The simple point is to look for the domain name corresponding to the IP of the process. In this process went through a few links, browser cache = = System Cache = + Router Cache =>ips Server cache = ROOT name server cache = top-level domain Server cache +/primary name server cache.
1. Browser cache. Search for chrome://net-internals/#dns under Google Chrome, you can see the DNS cache information.
2. System cache. System cache can be entered on the command line Vi/etc/hosts (Linux), view, and settings, of course, can be set fake, for local debugging.
DNS Load Balancing
DNS can return the IP of an appropriate machine to the user, for example, depending on the amount of load per machine, the distance from the user's geographic location, and so on, the process is DNS load balancing, also known as DNS redirection. The familiar CDN (Content Delivery Network) is the use of DNS redirection technology, the DNS server will return a user closest to the point of the IP address to the user, the server of the CDN node is responsible for responding to the user's request, provide the required content.
Two TCP connections
Three-time handshake to ensure connection reliability.
Three HTTP-related
After the server has established a connection with the host, the following host communicates with the server. A Web request is the process of a one-way request, which is the process by which a host requests data from the server and the server returns the corresponding data.
The browser generates an HTTP request based on the content of the URL, including the location of the requested file, the way the file was requested, etc.
After the server receives the request, it will decide how to obtain the corresponding HTML file according to the contents of the HTTP request;
The server sends the resulting HTML file to the browser;
When the browser has not fully received the HTML file, it starts rendering, displaying the Web page;
In the execution of HTML code, as needed, the browser will continue to request pictures, CSS, javsscript and other files, the process with the request HTML;
What happened from entering a URL to loading a page?