Talking about the web request process

1. B/S network architecture description

  The B/S network architecture is based on the unified application layer protocol HTTP to exchange data. The HTTP protocol adopts the communication method of stateless short links, and a data exchange is completed with one request.

In this way, more users can be served at the same time.

  When the user enters the url, DNS resolves the domain name into the corresponding IP address, and then accesses the server corresponding to the IP address, sends a get request to the server, and the server returns the default data resource. The data can be distributed, generally Static resources are stored in the CDN server.

  CDN (content delivery network): It is an advanced traffic distribution network built on the existing Internet. It can publish website content to the edge of the network closest to the user, so that the user can obtain the desired content nearby. CDN=mirror+cache+overall load balancing

2. Initiate a request

  Initiating an HTTP request is not much different from establishing a Socket connection. In essence, it is to establish a Socket connection. The commonly used package in java to initiate Http requests: HttpClient

3. HTTP protocol analysis

  Common request headers, response headers, status codes:

 

 

4. Domain name resolution

  When a user initiates a request, first check whether there is a DNS resolution result in the system cache. The cache file path of Windows is: C:\Windows\System32\drivers\etc\hosts, Linux:/etc/named.conf, if there is no access to Local DNS Server (the DNS server is provided by the network provider), if it still misses, it will go directly to the root server domain name server to request resolution, and the root domain name server will return to the local domain name server a primary domain name server (gTLD server) of the queried domain.

gTLD is an international top-level domain name server, gTLD returns a name server domain name server, and then accesses this server to obtain the ip value and TTL value of the domain name (the time of domain name resolution and cache is controlled by TTL) (name server may have multiple levels, or a GTM to load balancing control)

 

  5. CDN Architecture

  

    The company's own DNS server will re-alias the request to the DNS load balancing server in the CDN global, and then GTM will finally assign it back to the node closest to the user.

6. Load balancing

  Common load balancing are: link load balancing, cluster load balancing, operating system load balancing

(ps: The content comes from the book "In-depth Analysis of Java Web Technology Insider", summarizing the memo)

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325648749&siteId=291194637