Tech.view
科技视角
World Wide Wait
全球等待
The faster the internet becomes, the slower it loads pages
网速越高网页加载速度反而越慢
Feb 12th 2010 | From The Economist print edition
EVER noticed how long it takes for web pages to load these days? You click on a link and wait and wait, and then wait some more, for the content to trickle in. If nothing has happened after ten seconds or so, your impatient correspondent hits the browser’s stop button followed by the reload key. In desperation, he sometimes loads the link into a second or even a third browser tab as well, and bombards the website’s server with multiple requests for the page. If that fails, he gives up in disgust and reads a newspaper instead.
你是否留意过,如今打开网页需要多长时间?点击某个链接,你就开始等待,等了好久。看看,不行,还得再等一会,等着网页的内容姗姗来迟。如果等了10秒左右,仍然什么都没有,不耐烦的用户就会点击“刷新”键后面的“关闭”按钮。有时用户感觉十分不爽,“唰唰唰”,一下把这个链接点开两三个窗口,同时发出多个网页请求,对网站服务器进行“轰炸”。如果还是打不开,用户就会一脸厌恶地走开,转而去读报纸了。
Back in the early days of the internet, when most web users relied on dial-up connections, browsers were crude and web graphics were clumsy GIF files, eight seconds was considered the maximum people would stick around for a page to load. To increase “stickiness”, web designers pared their HTML code to the bone, collated their style-sheet data and JavaScripts into single files for more efficient caching elsewhere on the web, used fewer graphics and embraced the PNG and JPEG picture formats, with their smaller file sizes, as soon as they became available. Compared with text, pictures really were the equivalent of 1,000 words, at least when it came to the time taken to transmit them.
在因特网发展初期,大多数用户使用拨号连接,浏览器功能简单,网页图像都是粗糙的GIF文件。8秒,被视作用户打开网页的最大等待时间。为了让用户们不轻易关掉网页,网页设计人员将HTML编码大幅精简,将网页样式表和Java脚本文件整合成单个文件,以求浏览其它网页时有更高效的预读缓存技术。此外尽量少使用图像,而PNG和JPEG图形格式一经问世,就因其较小的文件规模而受到设计人员的青睐。同文字相比,图形就相当于1000个单字(至少在传输时间上如此)。
When your correspondent hand-coded The Economist’s first website back in 1994, a typical web page was about 50 kilobytes in size and dial-up modems could transfer no more than three kilobytes a second. To stay under the “eight-second rule”, pictures were kept to a minimum, so no page took more than three or four seconds to begin loading and never longer than 20 seconds to complete. The irony is that, with broadband nowadays more or less everywhere, overall connection speeds have gone up by leaps and bounds, yet the time taken to load web pages seems only to have got longer.
1994年设计人员手工编码完成了经济学人的第一个网站,当时的网页一般都大约50KB,而拨号调制解调器的传输速率不过3KB/s。为遵循“八秒准则”,图片都压至最少,所以网页不到三四秒就能开始加载,完成不超过20秒。具有讽刺意味的是,如今宽带基本实现普及,整体连接速率的提高更是一日千里,然而打开网页的等待时间却不减反增。
Your correspondent is admittedly near the end of the road for a digital subscriber line (DSL) connection. But even at three miles (5km) from the local telephone exchange, the speed of his broadband connection has inched up over the past few years from 65 kilobytes a second to more than 90 kilobytes a second—as the local line has been tweaked and legacy equipment like echo-cancelling coils removed from its junction boxes.
一般而言,客户都靠近数字用户线路(DSL)的末端。经过当地电信局信号转换后,即使再传输到3英里(5千米)之外,得益于当地线路微调,以及分线箱中回音消除器等陈旧设备的淘汰,宽带连接速度仍能从原来的65KB/s小幅增加到90KB/s。
Sure, he could get 650 kilobytes a second or more from a cable connection. But that would mean ditching his otherwise excellent satellite-TV service. Besides, optical fibre is slowly working its way up his hillside. He could soon have access to the internet at more than six megabytes a second—providing he is prepared to pay $140 a month instead of $21 for his existing DSL connection.
当然客户如果家里装了有线电视,速度会达到650KB/s甚至更高,那样家里原有的卫星电视也就形同虚设,用不上了。更何况,光纤正慢慢地向客户家所在的小山铺设,很快客户将能用上带宽高于6MB/s的因特网——前提是他放弃当前每月费用21美元的DSL连接,而每月交纳140美元享受这高带宽。
A 70-fold increase in speed for a sevenfold increase in price would seem a bargain. But your correspondent is not sure that more raw speed will solve the glacial loading problem. Even with his wimpy DSL connection, pages are rendered quickly enough once the website’s servers (and all the other computers along the route, plus those used to host adverts, graphics and miscellaneous layout bits) start giving his browser’s request some attention. The trouble is getting their attention in the first place.
速度增加70倍,价格才涨了7倍,似乎很划得来。可是客户心里没底儿:单纯的提速能否解决网页加载慢这个大问题?虽然DSL的速度很窝囊,一旦浏览器请求信息被服务器(也包括传输路线上的其它计算机,以及提供广告、图片以及页面上各种小版块的主机)受理,网页仍可以很快打开。问题就在于,如果让它们快速受理。
Before two computers can exchange information, they have to agree to talk to one another. Under normal conditions, this requires the user’s computer to send a request to the host computer, which then sends a response back to the user. Only after this “handshaking” is complete can the exchange of data commence. The time taken for this round-trip of request and acknowledgment determines the network’s latency.
两台计算机进行信息交换,首先他们要达成协议。一般而言,用户向主机发送请求信息,主机收到后向用户回复。只有经过这样一个“握手”后,数据交换才能开始。这个过程中请求信息和确认信息来回所花费的时间决定了当前网络的延时。
The latency cannot be less than the distance the electromagnetic signal has to travel divided by the speed of light. For instance, your correspondent’s home in Los Angeles is 400 miles from a colleague’s in San Francisco. In theory, then, the shortest round-trip between the two locations is 4.3 milliseconds. But if you “ping” the other computer, you’ll get a round-trip time of typically 700 milliseconds. That is still pretty quick, but it shows just how much time is spent waiting around for the various servers involved to handle the request.
延时势必大于等于电磁波以光速在这段距离上传输所需的时长。举个例子,客户家住洛杉矶,距旧金山一个同事400英里。理论上讲,电磁波在两个地点往返最短时间是4.3毫秒。而如果你使用ping命令测试网络连接,得到的延时一般都是700毫秒。尽管延时已经很小,这表明了信息传输时,在各个处理请求信息的相关服务器上等待所花费的时间。
There are many places along the way where the message can get bogged down. Queues can build up at routing servers that switch data packages along different routes to their destinations depending on the traffic. Worst of all, the DNS (Domain Name Server) computers used by your ISP can be overwhelmed as they try to translate the names of all the websites subscribers want to visit (say, www.economist.com) into their actual internet addresses (216.35.68.215). If you know it, try using the website’s numerical address rather than its verbose URL (Universal Resource Locator) name. That can sometimes halve the response time.
信息在传输线路中很多地方都会发生拥堵。路由服务器依据信息拥塞情况,为数据包选择不同的路径,最终都能到达目的地址。这样一来,路由器可能会有数据包大排长龙等待处理。客户的网络提供商使用的域名服务器(DNS)主机把用户访问的网站名(比如ww.economist.com)解析成实际的网络地址(216.35.68.215)。最坏情况下,解析信息过多会使解析服务器主机发生拥塞。如果你了解了这一点,以后上网时可以使用网站的数字地址,不要再罗罗嗦嗦地敲URL(统一资源定位器)名了。这样可能节省一半的响应时间。
The bottlenecks—whether at the DNS translators, the routing computers or the host’s own servers—stem largely from the way the mix of internet traffic has changed faster than the infrastructure used to carry it. Websites that were once just 50 kilobytes of text and tiny pictures now come with music, video and animated graphics. YouTube, Hulu, iTunes and BitTorrent have much to answer for.
不论是DNS解析器,路由选择主机抑或是主机自带的服务器,其瓶颈不在于信息传输的网络基础设施,而皆在于,当前网络传输信息组合方式的变动步伐日益加快。曾经只有50KB的文本外加一丁点图片的网站如今已是音乐、视频、动画,样样俱全。youtube,Hulu,iTunes和比特流等大型网站花样更多。
It is even worse on the mobile phone companies’ proprietary networks. Carriers are struggling to keep up with demand as subscribers use their smart-phones to check Facebook, stream videos from YouTube and play interactive games. Where a mid-range smart-phone would consume about 100 megabytes of data a month, more advanced models like the Apple iPhone or Motorola Droid, with fully fledged browsers and access to thousands of downloadable applications, tend to consume over 500 megabytes a month. With the imminent arrival of tablet computers like the iPad, which come with wireless modems, the appetite for downloadable data could hit a gigabyte a month (see the lead story in this week’s Business section).
移动电话公司的专用网络情况更差。用户们通过智能手机上Facebook,在youtube上看视频,玩在线游戏等,公司则尽力满足客户们的网络需求。一个中等的智能机每月使用流量约100M,而更高级的智能机,比如苹果的iPhone和摩托罗拉的Droid,配备有功能完备的浏览器和数千个应用程序的下载链接,这样一来,每月浪费的流量将超过500M。随着iPod等平板电脑以及无线调制解调器呼之欲出,每月下载的数据量将突破1G大关(详见本周商业板头条)。
And this is just the beginning. On the internet, the average latency for corporate websites in America is currently around 350ms, according to the Network Weather Report operated by the University of California, Los Angeles. Google’s latency is 150ms, Facebook’s 285ms and YouTube’s 515ms. Such latencies will have to come down considerably if the next generation of internet applications, such as telepresence, high-definition video streaming and remote surgery, are to fulfil their promise.
这还仅仅是问题的开始。根据洛杉矶加利福尼亚大学的网络情况报告,在因特网上,美国的企业网站目前平均延时约350毫秒,谷歌为150毫秒,facebook为285毫秒,youtube为515毫秒。如果网真技术,高清视频,远程手术等下一代因特网应用真能做到“名符其实”,那么还应该进一步大幅降低这些网络延时。
The future is beckoning. Netflix has just announced an on-demand video-streaming service offering full high-definition picture quality (so-called 1080p, which has 1,080 lines in its picture) with 5.1-channel surround sound. Each stream being watched will require a megabyte a second of bandwidth and a latency of less than 60ms if it is to deliver crisp, pin-sharp video and pristine sound.
未来在向我们招手。Netflix公司最近宣布提供一项按需订制的视频流服务,提供高清画质(即1080p,显像行有1080行 )和5.1声道环绕声。每个放映的视频流要求带宽1M/s,延时60毫秒以下,才能提供流畅清晰、音质纯正的视频。
For the internet service providers, that means stepping up investment substantially. But adding a lot more routers to the internet would complicate matters hugely and do little to solve the latency problem. If anything, it would actually increase the number of potential bottlenecks.
对因特网服务提供商而言,那意味着增加大量的投资。通过增加路由器的方式只能使网络结构更加复杂,对解决延时问题于事无补。这样做只能增加潜在瓶颈的数量。
A better solution might be to light up more of the “dark fibre” installed during the heady days of the dotcom boom, but left lying unused beneath the streets since the bubble burst nearly a decade ago. That is what a number of securities firms have been quietly doing. When shaving a millisecond off the time needed to execute automated trades can increase revenue by $100m, there is plenty of incentive to build private optical networks with latencies approaching zero.
更好的解决方案或许是,重新利用过去铺设的直驳光纤。近十年前,网络迅速发展,当时铺设了大量的直驳光纤,却一直弃在街道下面无人问津。一些证券公司就在暗中利用这些光纤。执行股票自动交易时每减少一毫秒的延时,公司收入就能增加一亿美元,所以铺设延时近乎零的私人光纤网络,不乏动力。
Indeed, Google said this week that it was not going to hang around waiting for the telecoms industry to build the new optical web. The company is planning a low-latency fibre network that will be capable of delivering speeds of over 100 megabytes a second for communities of 50,000-500,000 people. With luck, other internet service providers everywhere will get the message.
事实上,谷歌这周表示将不再等待电信公司铺设新的光纤网络,而是打算自己铺设低延时的光纤网络,届时能为5万到50万的用户提供超过100M/s的带宽。一切顺利的话,其它的因特网服务提供商都会心领神会的。
译者:czechoslovakia
欲与译者本人对该文进行切磋,请到如下链接:http://www.ecocn.org/bbs/viewthread.php?tid=31294