What happens after the browser enters the URL

Source: Internet
Author: User
Tags domain name server browser cache

If Www.cnblogs.com is entered in the browser, then enter

DNS resolution

The browser checks to see if the browser cache has IP corresponding to the domain name.

The browser finds out if the operating system has a corresponding DNS resolution result (Hosts file ).

Find the router cache.

The browser client sends a DNS query message to the local domain name server that contains the domain name www.cnblogs.com. (about 80% of the domain name resolution is done here)

The local DNS server forwards the query message to the root DNS server, the root DNS server notices its COM suffix, and returns the IP address of the COM top-level domain name server to the local DNS server.

The local DNS server sends a query request to the Comdns server again, and the COMDNS server notices its cnblogs.com suffix and responds with the IP address of the authoritative DNS server that owns the domain name.

The local DNS server makes a request to the authoritative DNS server to obtain the IP address of the www.cnblogs.com.

Finally, the local DNS server sends a response message to the browser that contains the IP address of the www.cnblogs.com.

DNS Load Balancing:

It is the principle of the DNS server to configure multiple IP addresses for the same domain name, when answering DNS queries, the DNS server for each query will be in the DNS file in the host record of the IP address in order to return the different resolution, the client's access to different machines to boot up, Enable different clients to access different servers to achieve load balancing purposes? for example, depending on the amount of load per machine, the distance between the machine and the user's location.

The IP returned by the load balancer here may also be the IP of a load balancer server.

Establish a TCP connection

Three-time handshake

Send HTTP request
GET http://www.cnblogs.com/HTTP/1.1Host:cnblogs.comUser-Agent:Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Accept-encoding:gzip, Deflateconnection:keep-alive

The server processes the request and returns an HTTP response
http/1.1 okcache-control:private, No-store, No-cache, Must-revalidate, Post-check=0expires:sat, Jan 2000 00:00:00 gmtp3p:cp= "DSP law" pragma:no-cachecontent-encoding:gzipcontent-type:text/html; Charset=utf-8x-cnection:closetransfer-encoding:chunkeddate:fri, 09:05:55 GMT

The Content-type is set to text/html. Instructs the browser to render the response content as HTML instead of downloading it as a file.

Reverse proxy:

The reverse proxy server is located in the Web site, and the proxy Web server receives an HTTP request to forward the request.

The reverse proxy server has the following features:

  ① Protect website security: Any request from the Internet must go through a proxy server first;

  ② accelerates Web requests by configuring caching: reduces load pressure on real Web servers;

Wikipedia and some blogs will cache hot entries, posts, blogs on reverse proxy servers, notify reverse proxy Server cache invalidation when dynamic content changes, and reload dynamic content.

  ③ load Balancing: distribute requests evenly and balance the load pressure of each server in the cluster;

To close a TCP connection

Browser parsing Render page

When the browser renders HTML, it will notice the need to get other URLs (JS,CSS). The browser sends a GET request to retrieve each file.

These static resources may be available at CND, and if not, return to the source station to fetch the required data.

CDN Acceleration:

The CDN (Content distribution network) is still a cache that caches data in the closest Network service room to the user, allowing users to obtain data at the fastest speed. The so-called "network access first jump".

 CDN only caches high-frequency hot content (such as images, videos, CSS, JS scripts, etc.), which can greatly speed up user access and reduce data center load.

When the browser parses the HTML file, it loads "top-down" and parses the render during the loading process. During parsing, the request process is asynchronous and does not affect the loading of HTML documents when external resources are encountered, such as slices, Iconfont, CSS, and so on.

During parsing, the browser first parses the HTML file to build the DOM tree, then parses the CSS file to build the render tree, and when the render tree is built, the browser begins to lay out the render tree and draw it onto the screen.

Each element in the DOM node is in the form of a box model, which requires the browser to calculate its location and size, which is called relow (reflux);

When the box model's position, size, and other attributes, such as color, font, etc. are determined, the browser begins to draw the content, a process called repain (redraw).

When the document loading process encountered a JS file, the HTML document will suspend rendering (load resolution rendering synchronization) of the thread, not only to wait for the document JS file loading complete, but also wait for the resolution to complete, before you can restore the HTML document rendering thread.

Because JS has the possibility of modifying the DOM, the most classic document.write, which means that after the completion of JS execution, all subsequent downloads of resources may not be necessary, which is the root cause of JS blocking the subsequent download of resources.

CSS put the top of the page, JS put the page at the bottom: the browser will download the full CSS before starting to render the entire page, so it is best to put the CSS on the top of the page;

and the browser after loading JS will be executed immediately, there may be blocking the entire page, resulting in slow page display, so it is best to put JS at the bottom of the page;

What happens after the browser enters the URL

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.