DNS resolution (caching)
What is DNS?
- DNS is the domain name System protocol (DNS), which translates IP addresses and domain names into each other. DNS resolution is the application of DNS, which translates domain names into IP addresses when you visit domain names
What is DNS cache
- Simply put, every time you visit a domain name, browsers, computers and other devices record the IP address for you, greatly reducing the cost of web requests
The lookup order of the cache
- Lookup the browser DNS cache
- Find the local DNS cache (CMD -> ipconfig /displaydns)
- Lookup the routing DNS cache
- Lookup the carrier’s DNS cache (normally ends here at most)
- Find 13 root DNS servers around the world (recursive query, almost never happen)
Establish a connection (three handshakes)
Three handshake process
- First time: The browser sends a connection request to the server
- Second time: After the server receives the request, the server sends the connection approval response to the browser
- Third time: The browser receives the response and sends a signal to the server indicating that the connection is successful
Send a request (request message)
Receive response (response message)
Browser parsing HTML
- Pre-parsing: make a request for all external resources (.css,.js,…)
- Parsing HTML: Generate a DOM tree
- Parse the CSS: Generate the CSSOM tree
- Combine the above two into a Render tree
- Each visible node is traversed from the root node
- Match each node with the appropriate CSS style
- Show visible nodes
- Check whether JS operates on the DOM
- There are: redraw/reflow
- No: NULL
- Display the page
Disconnect (wave four times)
- First: The browser sends a request to the server to disconnect
- Second: The server accepts the request and sends a response to the browser, which may not be complete
- Third: The server disconnects after sending response information
- Fourth: The browser receives the response and sends a confirmation message to the server
If there are any mistakes, please mention them
I hope everyone can get the offer as soon as possible, come on, encourage each other