<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      (譯)How content delivery networks (CDNs) work

        翻譯一篇Nicholas C.Zakas的文章,原文在這里。自己看和翻譯還是兩碼事,第一次這么正經的翻譯,翻譯得比較晦澀,喜歡英文原文的同學可以挪步,也可以選擇對照英文閱讀。

        正文如下:

        Content delivery networks (CDNs) are an important part of Internet infrastructure that are frequently used without a full understanding of what’s happening behind the scenes. You’ll hear people saying, “oh, we put that on the CDN” or “make sure static assets go on the CDN,” when they have only a rudimentary idea of what CDNs are and how they work. As with most pieces of technology, CDNs are not magic and actually work in a pretty simple and straightforward manner.

        內容分發網絡(CDN)是互聯網基礎設施中非常重要的一部分,被人們廣泛使用,雖然人們沒有對它內部的運行的機制有全面的理解。你可能經常聽到人們說,"我把那個放在CDN上了"或"確保靜態資源都放在CDN上",當他們只對CDN和它的工作原理有個基本的了解。和大多數技術一樣,CDN沒有多少神奇的地方,它實際上的運行其實只是一個相當簡單和直接的方式。

        When a web browser makes a request for a resource, the first step is to make a DNS request. Making a DNS request is a lot like looking up a phone number in a phone book: the browser gives the domain name and expects to receive an IP address back. With the IP address, the browser can then contact the web server directly for subsequent requests (there are actually multiple layers of DNS caching, but that’s beyond the scope of this post). For your simple blog or small commercial web site, a domain name may have a single IP address; for large web applications, a single domain name may have multiple IP addresses.

        當一個web瀏覽器發送一個資源請求,第一步發送的是一個DNS請求。發送一個DNS請求很像在號碼簿上查找一個電話號碼:瀏覽器提供域名,要獲得一個IP地址。有了這個IP地址,瀏覽器就可以在后續資源的請求上直接與web服務器通訊(DNS緩存實際上有很多層,但是這不是這篇文章所要討論的)。對于你自己的一個簡單的博客或是一個很小的商業網站那,一個域名可能只有一個IP地址;但對于大型的web應用,一個域名就可能對應很多的IP地址。

        Physics determines how fast one computer can contact another over physical connections, and so attempting to access a server in China from a computer in the United States will take longer than trying to access a U.S. server from within the U.S. To improve user experience and lower transmission costs, large companies set up servers with copies of data in strategic geographic locations around the world. This is called a CDN, and these servers are called edge servers, as they are closest on the company’s network to the end-user.

        物理連接上,一臺計算機的物理環境決定它連接到其他計算機的速度。所以在美國連接一臺在中國的服務器將比連接到一臺在美國的服務器所花的時間要長。為了提高用戶體驗,減少遠距離連接所花費的代價,很多大公司在世界范圍內設立了很多存放了相同數據服務器。這就叫作CDN,這些服務器叫做邊緣服務器,因為它們最貼近最終端用戶的網絡。

       

      DNS解決方案(DNS resolution)

        When the browser makes a DNS request for a domain name that is handled by a CDN, there is a slightly different process than with small, one-IP sites. The server handling DNS requests for the domain name looks at the incoming request to determine the best set of servers to handle it. At it’s simplest, the DNS server does a geographic lookup based on the DNS resolver’s IP address and then returns an IP address for an edge serverthat is physically closest to that area. So if I’m making a request and the DNS resolver I’m routed to is Virginia, I’ll be given an IP address for a server on the East coast; if I make the same request through a DNS resolver in California, I’ll be given an IP address for a server on the West coast. You may not end up with a DNS resolver in the same geographic location from where you’re making the request.

        當瀏覽器發送了一個DNS請求,請求一個被CDN處理過的域名,這和它向一個小的、只有一個ip地址的網站域名發送請求在過程上有輕微的差別。服務器處理域名的DNS請求會根據進來的請求決定返回最佳的處理方式。最簡單的,DNS服務器基于DNS查找者的IP地址來做一個地理查找,然后返回一個離用戶最近的邊緣服務器的IP地址。所以,如果DNS解析路由到我的請求是來自弗吉尼亞州,我將得到一個東海岸的服務器的IP地址,如果我在加州通過DNS解析器發送了一個同樣的請求,我會得到一個西海岸的服務器的IP地址。你可能不會得到一個和你發送請求地理位置相同的DNS分析結果。

        

        That’s the first step of the process: getting the request to the closest server possible. Keep in mind that companies may optimize their CDNs in other ways as well, for instance, redirecting to a server that is cheaper to run or one that is sitting idle while another is almost at capacity. In any case, the CDN smartly returns the best possible IP address to handle the request.

        這是過程的第一步:到最近的服務器得到請求。請記住,公司可能會對他們的CDN進行其他方式的優化,例如,重定向到的服務器運行成本更低或閑置,而其他的幾乎滿負荷。在任何情況下,CDN返回處理該請求最好的IP地址。

       

      訪問內容(Accessing content)

        Edge servers are proxy caches that work in a manner similar to the browser caches. When a request comes into an edge server, it first checks the cache to see if the content is present. The cache key is the entire URL including query string (just like in a browser). If the content is in cache and the cache entry hasn’t expired, then the content is served directly from the edge server.

        邊緣服務器的工作方式類似于瀏覽器緩存的代理緩存。當一個請求到邊緣服務器,它首先檢查緩存中是否還包含請求的內容。緩存的key是整個URL,包括查詢字符串(就像在瀏覽器中)。如果內容是在緩存中,并該緩存條目沒有過期,邊緣服務器就會將內容直接送達出去。 

        If, on the other hand, the content is not in the cache or the cache entry has expired, then the edge server makes a request to the origin server to retrieve the information. The origin server is the source of truth for content and is capable of serving all of the content that is available on the CDN. When the edge server receives the response from the origin server, it stores the content in cache based on the HTTP headers of the response.

        另一方面,如果在請求的內容不在緩存中或緩存已經過期,邊緣服務器就會向源服務器發送請求來獲得內容。源服務器里內容是最正確的,是內容的最初來源。它可以提供CDN能提供的所有內容。當邊緣服務器接收從到源服務器的內容,它將基于響應內容中的HTTP頭建立內容的緩存。

        Yahoo! created and open sourced the Apache Traffic Server, which is what Yahoo! uses in its CDN for managing this traffic. Reading through the Traffic Server documentation is highly recommended if you’d like to learn more about how cache proxies work.

         雅虎創建和開源的Apache Traffic Server,這是雅虎用來管理其網絡阻塞在它的CDN中使用的服務器。如果你想了解緩存代理是如何工作的,強力建議通讀Apache Traffic Server文檔。

       

      舉例(Example)

        For example, Yahoo! serves the YUI library files off of its CDN using a tool called the combo handler. The combo handler takes a request whose query string contains filenames and concatenates the files into a single response. Here’s a sample URL:

        例如,雅虎提供的YUI庫文件它的CDN使用的工具,稱為combo handler。combo handler將請求的查詢字符串包含到一個單一的響應的文件名和連接文件。下面是一個示例網址:

        http://yui.yahooapis.com/combo?3.4.1/build/yui-base/yui-base-min.js&3.4.1/build/array-extras/array-extras-min.js

        The domain yui.yahooapis.com is part of the Yahoo! CDN and will redirect you to the closest edge server based on your location. This particular request combines two files, yui-base-min.js andarray-extras-min.js, into a single response. The logic to perform this concatenation doesn’t exist on the edge servers, it only exists on the origin server. So if an edge server receives this request and has no content, a request is made to the origin server to retrieve the content. The origin server is running the proprietary combo handler (specified by /combo? in the URL) and so it combines the files and returns the result to the edge server. The edge server can then serve up the appropriate content.

        該域名yui.yahooapis.com是雅虎的CDN的一部分,它將根據你的位置幫你重定向到離你最近的邊緣服務器。這種特殊的請求將兩個文件:yui-base-min.js和array-extras-min.js,合并成一個單一的響應。理論上來說,處理這個串聯請求的內容在邊緣服務器上不存在,只存在于源服務器。因此,如果一臺邊緣服務器接收到這個請求但它沒有這個內容,它就發送請求到源服務器去檢索內容。源服務器上運行著combo handler(在URL中指定成 /combo? 形式),所以它合并文件,并將結果返回到邊緣服務器。以后邊緣服務器就可以提供適當的內容。


      什么是靜態(What does static mean?)

        I frequently get confused looks when I describe systems similar to the combo handler. There is a misconception that CDNs act like FTP repositories, where you simply upload static files so that others can retrieve them. I hope that it’s clear from the previous section that this is not the case. An edge server is a proxy, the origin server is the one that tells the edge server exactly what content should be returned for a particular request. The origin server may be running Java, Ruby, Node.js, or any other type of web server and, therefore, can do anything it wants. The edge server does nothing but make requests and serve content. So the YUI combo handler exists only on the origin server and not on the edge servers.

        當我描述一個類似于combo handler的系統時,我經常感到困惑。有人認為的CDN的運行就像FTP庫,你只需上傳靜態文件,其他人就可以拿到他們想要的靜態文件,這是一種誤解。我希望通過上面的闡述,你能明白,其實不是這樣的。邊緣服務器只是一個代理,源服務器主宰著邊緣服務器到底一個的請求應返回什么樣的內容。源服務器可運行Java、Ruby、Node.js或任何其他類型的Web服務,因此,可以做任何它想做的。邊緣服務器除了發送請求(到源服務器)、提供內容(給請求)之外,什么也不做。所以YUI combo handler只存在于源服務器上而不是在邊緣服務器。 

        If that’s the case, why not serve everything from the CDN? The CDN is a cache, meaning that is has value when it can serve data directly and not need to contact the origin server. If an edge server needs to make a request to the origin server for every request, then it has no value (and in fact, costs more than just making the request to the origin server itself).

        如果是這樣的話,為什么不從CDN提供一切(內容)服務呢? CDN是一個緩存,這意味著只有直接提供數據而不需要和源服務器交互時才有價值。如果邊緣服務器對于每一個請求都需要請求源服務器,那么它有沒有價值的(事實上,成本比只是發送請求到源服務器本身還高)。

        The reason JavaScript, CSS, images, Flash, audio, and video are frequently served from CDNs is precisely because they don’t change that frequently. That means not only will the same user receive content from cache, but all users will receive the same data from cache. Once the cache is primed with content, all users benefit. A site’s homepage is a poor candidate for edge caching because it’s frequently customized per user and needs to be updated several times throughout the day.

         JavaScript,CSS,圖像,Flash,音頻,和視頻一般都使用CDN服務的原因,它們的改動不是很頻繁。這意味著不僅相同的用戶會從緩存中收到內容,所有用戶都將收到從緩存中相同的數據。一旦預先緩存了需要的內容,所有用戶受益。網站的主頁不需要使用邊緣緩存(CDN),因為它經常需要根據每個用戶的需要在一天中更新很多次。

       

      緩存過期(Cache expiration)

        Yahoo! performance guidelines specify that static assets should have far-future Expires headers. This is for two reasons: first, so the browser will cache the resources for a long time, and second, so the CDN will cache the resources for a long time. Doing so also means you can’t use the same filename twice, because it may be cached in at least two places and users will receive the cached version instead of the new one for quite a while.

        雅虎性能準則指定靜態的資源應該有一個未來的過期頭。這有兩個原因:第一,(沒有過期頭的話)瀏覽器會在很長一段時間內緩存資源,第二,CDN也將緩存的資源很長一段時間。這樣做也意味著你不能兩次使用相同的文件名,因為它可能至少在兩個地方(CDN/瀏覽器)被緩存,用戶將在相當長一段時間內獲得舊的緩存版本而不是新的版本。

        There are several ways to work around this. The YUI library uses directories containing the version number of the library to differentiate file versions. It’s also common to append identifiers to the end of a filename, such as an MD5 hash or source control revision. Any of these techniques ensures that users are receiving the most up-to-date version of the file while maintaining far-future Expires headers on all requests.

         有幾種方法可以解決這個問題。 YUI使用目錄來區分文件版本,這些目錄包含library的版本號。還有一種常見的方式是在文件名的末尾追加標識符的,如MD5哈希或源代碼控制版本。這些技術都確保用戶接收到文件是最新版本,同時保持將來所有的請求頭到期。

       

      結論(Conclusion )

        CDNs are an important part of today’s Internet, and they’re only going to become more important as time goes on. Even now, companies are hard at work trying to figure out ways to move more functionality to edge servers in order to provide users with the fastest possible experience. This includes a technique called Edge Side Includes (ESI) which is designed to serve partial pages from cache. A good understanding of CDNs and how they work is key to unlocking greater performance benefits for users.

         CDN是現今互聯網的一個重要組成部分,它只是會隨著時間的推移變得更加重要。即使現在,公司正在努力試圖將更多的功能邊緣服務器,以便為用戶提供盡可能最快的體驗。這包括所謂Edge Side Includes(ESI),其目的是為從緩存中的提供部分頁面。對CDN以及它如何工作的一個深入的理解,是能否為用戶帶來更大的性能優勢的關鍵。

      posted @ 2011-12-03 17:17  慢熱君Kevin  閱讀(950)  評論(1)    收藏  舉報
      主站蜘蛛池模板: 国产一区二区三区黄色片| 丝袜美腿亚洲综合第一区| 久久精品国产精品亚洲蜜月| 国产一区二区三区精品自拍| 成人3D动漫一区二区三区| 九九热在线视频观看精品| 国产精品中文字幕二区| 动漫av网站免费观看| 乱女乱妇熟女熟妇综合网| 亚洲精品人成网线在线| 又大又粗又爽的少妇免费视频| 精品国产午夜福利在线观看| 韩国午夜福利片在线观看| 久久婷婷五月综合色精品| 国产精品白嫩极品在线看| 午夜福利高清在线观看| 女高中生强奷系列在线播放| 欧洲国产成人久久精品综合| 久久亚洲精品人成综合网| 国产在线观看91精品亚瑟| 无码国产精品一区二区免费虚拟vr | 在线看国产精品自拍内射| 最近最好的2019中文| 朝鲜女子内射杂交bbw| 亚洲精品天堂在线观看| 亚洲国产精品日韩AV专区| 久久av无码精品人妻系列试探| 国产午夜亚洲精品福利| 在线看国产精品三级在线| 亚洲国产欧美不卡在线观看| 九九热99精品视频在线| 亚洲国产成人AⅤ片在线观看| 亚洲AV天天做在线观看| 日本一区二区三区东京热| 日本熟妇浓毛| 伊人春色激情综合激情网| 成人拍拍拍无遮挡免费视频| 国产一级av在线播放| 国产成人综合在线观看不卡| 国产成人精品无码一区二区老年人 | 亚洲国产大片永久免费看|