What happened from entering a URL to loading a page?

Source: Internet
Author: User
Tags browser cache domain server

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.

    1. 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.

    2. After the server receives the request, it will decide how to obtain the corresponding HTML file according to the contents of the HTTP request;

    3. The server sends the resulting HTML file to the browser;

    4. When the browser has not fully received the HTML file, it starts rendering, displaying the Web page;

    5. 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?

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.