從在瀏覽器輸入URL到頁面載入完成所發生的,url頁面
大致意思就是:如果有cache就直接顯示。否則就在本機找IP,通過DNS找到IP並返回給瀏覽器。然後瀏覽器通過TCP和server之間溝通,server返回資料或者錯誤資訊。然後就把資料render到browser。
例如我要開啟facebook.com,值得一提的兩點:一是可能會重新導向網頁,如從http://facebook.com到http://www.facebook.com。二是發送的http GET請求裡是包含cookie的
關於頁面的圖片,音頻,視頻的載入順序,可以自訂來提高初始載入速度。
此外還可以考慮到CDN(content delivery network)的involve
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 to use CDN?
- It will be most effective 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 would work similarly for IPv6-only client, but I have yet to see such workstation):
- browser checks cache; if requested object is in cache and is fresh, skip to #9
- browser asks OS for server's IP address
- OS makes a DNS lookup and replies the IP address to the browser
- browser opens a TCP connection to server (this step is much more complex with HTTPS)
- browser sends the HTTP request through TCP connection
- browser receives HTTP response and may close the TCP connection, or reuse it for another request
- 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)
- if cacheable, response is stored in cache
- browser decodes response (e.g. if it's gzipped)
- browser determines what to do with response (e.g. is it a HTML page, is it an image, is it a sound clip?)
- 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 many 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 performed 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 is 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/
當開啟瀏覽器,從在地址欄裡輸入一個URL開始,到出現整個頁面,網路上都發生了什事
開啟瀏覽器 輸入URL 斷行符號以後就會在網路上尋找路由器 找到路由器裡面以後就讀路由表 理論上在12個路由表之內能找到你所輸入的URL 然後空連結到這個地址 如果是http頭然後就會進行預設的監聽80連接埠 如果是FTP頭就會監聽其它連接埠 監聽正常以後會進行握手 握手就是確定協議類型 接著會話 你的電腦像URL提交需要資訊的一個表單 電腦說我要你這個地址下面的所有WEB頁面 那邊的WEB網站會要你的電腦出示身份證 看看你的電腦是不是好人 如果是好人 就說OK 我給你 但是我先給你一份我WEB裡面資料的單據把 就是cookies 同時WEB網站在自己運算 把網頁代碼運算成使用者可以接受的視窗網頁 然後你的電腦拿到了這個單據 再根據單據裡面的內容和WEB要 WEB就把運算好的網頁返回到你的瀏覽器中。
大概就是這樣
在瀏覽器上鍵入URL後傳回網頁的過程,該過程涉及什類型客戶服務端互動?
人機互動,用戶端與伺服器端互動