From entering the URL in the browser to loading the page

Source: Internet
Author: User

From entering the URL in the browser to loading the page

The general meaning is: if there is a cache, it will be displayed directly. Otherwise, find the IP address on the local machine, find the IP address through DNS, and return it to the browser. Then, the browser communicates with the server over TCP, and the server returns data or error messages. Then render the data to the browser.

For example, if I want to open facebook.com, it is worth mentioning two points: one is that the web page may be redirected, such as from http://facebook.com to http://www.facebook.com. Second, the http GET request sent contains cookies.

You can customize the loading sequence of page images, audios, and videos to Increase the initial loading speed.

In addition, you can also consider the involve of the CDN (content delivery network ).

What are the advantages and disadvantages of using CDN?

  • The disadvantages may be that it costs money, and it adds a bit of complexity to your deployment procedures.

  • The main advantage is an increase in the speed with which the content is delivered to the users.

    When en to use CDN?

    • It will be most valid tive when you have a popular public website with some type of static content (images, scripts, css, etc ).

      Is CDN a performance booster?

      • In general, yes. when a specific request is made by a user, the server closest to that user (in terms of the minimum number of nodes between the server and the user) is dynamically determined. this optimizes the speed with which the content is delivered to that user.

        In an extremely rough and simplified sketch, assuming the simplest possible HTTP request, no proxies and IPv4 (this wocould work similarly for IPv6-only client, but I have yet to see such workstation ):

        1. Browser checks cache; if requested object is in cache and is fresh, skip to #9
        2. Browser asks OS for server's IP address
        3. OS makes a DNS lookup and replies the IP address to the browser
        4. Browser opens a TCP connection to server (this step is much more complex with HTTPS)
        5. Browser sends the HTTP request through TCP connection
        6. Browser errors es HTTP response and may close the TCP connection, or reuse it for another request
        7. Browser checks if the response is a redirect (3xx result status codes), authorization request (401), error (4xx and 5xx), etc .; these are handled differently from normal responses (2xx)
        8. If cacheable, response is stored in cache
        9. Browser decodes response (e.g. if it's gzipped)
        10. Browser determines what to do with response (e.g. is it a HTML page, is it an image, is it a sound clip ?)
        11. Browser renders response, or offers a download dialog for unrecognized types

          Again, discussion of each of these points have filled countless pages; take this as a starting point. also, there are processing other things happening in parallel to this (processing typed-in address, adding page to browser history, displaying progress to user, notifying plugins and extensions, rendering the page while it's downloading, pipelining, connection tracking for keep-alive, etc .).

          **************************************** **************************************** **************************************** **************************************** **********

          First the computer looks up the destination host. If it exists in local DNS cache, it uses that information. Otherwise, DNS querying is already med until the IP address is found.

          Then, your browser opens a TCP connection to the destination host and sends the request according to HTTP 1.1 (or might use HTTP 1.0, but normal browsers don't do it any more ).

          The server looks up the required resource (if it exists) and responds using HTTP protocol, sends the data to the client (= your browser)

          The browser then uses HTML parser to re-create document structure which is later presented to you on screen. if it finds references to external resources, such as pictures, css files, javascript files, these are delivered the same way as the HTML document itself.


          Reference:

          Http://stackoverflow.com/questions/2092527/what-happens-when-you-type-in-a-url-in-browser

          Http://fex.baidu.com/blog/2014/05/what-happen/

Related Article

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.