Monday, June 20, 2011

Google's SPDY Project: The Successor to HTTP?


If there’s anything Google loves as much as search, it’s speed. Chrome was built on a foundation of speed. Faster JavaScript, faster graphics acceleration, faster browser startup. Google Code has a page dedicated specifically to speed. And on top of all that, Google started a project called SPDY (SPeeDY. Get it?) that aims to reach beyond the influence of the Chrome browser to speed up the entire web.
Until now, SPDY has been an internal experiment at Google--as you can imagine, rolling out a protocol that modifies HTTP is no easy task. That’s exactly what SPDY does, and Google’s used the protocol to lower page load times by as much as 64%. To take the first step into the web at large, Google’s partnering with an optimization company called Strangeloop--together they’ll insert SPDY into a software layer between Internet servers and users.


If SPDY takes off, it has the potential to change the foundation of Internet technology as we know it.
SPDY wasn’t born simply because Google loves making the web faster. The company saw a real problem with the way HTTP handles Internet traffic. With websites growing more sophisticated year after year, incorporating a greater number of page elements and images as broadband capabilities increase, Internet protocols need to be equipped to keep up. HTTP suffers from several issues that hold it back, like optional (as opposed to mandatory) data compression and a flawed system for retrieving data:
Because HTTP can only fetch one resource at a time (HTTP pipelining helps, but still enforces only a FIFO queue), a server delay of 500 ms prevents reuse of the TCP channel for additional requests. Browsers work around this problem by using multiple connections. Since 2008, most browsers have finally moved from 2 connections per domain to 6.
Even that multiple connection approach presents a problem: poor optimization means page loads can be delayed by unimportant images as elements from the bottom of a page load before stuff at the top. Like HTTP, SPDY is an application-layer protocol for requesting and receiving data. Unlike HTTP, SPDY creates a session layer atop SSL that allows for multiple concurrent data streams via a single TCP connection. One connection may sound slower than six, but Google explains how the system is actually faster:
Multiplexed streams
SPDY allows for unlimited concurrent streams over a single TCP connection. Because requests are interleaved on a single channel, the efficiency of TCP is much higher: fewer network connections need to be made, and fewer, but more densely packed, packets are issued.
Request prioritization
Although unlimited parallel streams solve the serialization problem, they introduce another one: if bandwidth on the channel is constrained, the client may block requests for fear of clogging the channel. To overcome this problem, SPDY implements request priorities: the client can request as many items as it wants from the server, and assign a priority to each request. This prevents the network channel from being congested with non-critical resources when a high priority request is pending.
SPDY offers one other interesting advantage: the ability for servers to push data to clients without a request, something HTTP can’t do. In some cases, SPDY can’t compress all the necessary data into a single TCP stream and has to follow the HTTP approach of multiple connections to a server. Even then, it’s more efficient--Google documented 27.93% speed increases in those cases, compared to 45.51% improvement on a single connection. With all that said, Google stresses SPDY doesn’t actually replace HTTP--it “still uses HTTP methods, headers, and other semantics” but augments those basics with Google-engineered enhancements.
Obviously there’s no way for Google to roll SPDY out across the Internet right away--millions of websites and servers and web browsers are only built to understand HTTP. Chrome, however, supports SPDY, and Strangeloop is offering an interim solution with its Site Optimizer software. Sites that employ Site Optimizer can enable SPDY--when visitors browse the site using Chrome, the software will simply take data from the server and deliver it via Google’s protocol. The 10-20% faster page loads Site Optimizer supposedly provides aren’t quite as good as direct server implementation, but they’re a good start.
Strangeloop’s president has wisely pointed out where SPDY could really shake things up: the mobile sector. Google would no doubt be happy to see Internet Explorer, Firefox and Safari adopt SPDY, but it can roll the protocol into the Android browser to help speed up mobile traffic. On 3G connections, every little speed boost will be especially noticeable--and this gives us another reason to pine for Chrome on Android.
interesting :


No comments:

Post a Comment