Have you ever felt frustrated by a web page’s slow loading time, or been concerned about its security (or lack thereof)? Google is developing something right now that should resolve some of those issues. It’s called SPDY, and it will work in conjunction with HTTP to make the internet a lot faster.
First, What Is HTTP?
Short for HyperText Transfer Protocol, HTTP serves as the underlying protocol for the Internet. It is an application-level protocol, a set of rules defining how two devices communicate and share data with one another. Unfortunately, because of how it was designed, web page latency or slow loading times is a significant problem faced by HTTP. Of course, if you use HTTPS, some of this may be less of an issue.
HTTP originally mandated that communication to the server be closed after each request/response cycle, where one device sends a request for data to another device and then receives that data from the other device. This resulted in the complete set up and break down of a TCP channel for every request, which was expensive in terms of bandwidth and put a lot of unnecessary strain on the computers and servers. TCP, like HTTP, is a web protocol that specifically provides guaranteed delivery, duplicate suppression, in-order delivery, flow control, congestion avoidance and other transport features.
Another problem with it was that it contained FIFO semantics. FIFO, or ‘First In, First Out’ semantics essentially dictate that the first request to come in to the server will have the first response out. But this can be a problem. When there is a slow request at the front of the queue, the requests behind it will have to wait longer and there is a back-flow of requests.
Then, along came HTTP 1.1 with some major changes aimed at resolving this issue. For one, HTTP 1.1 allowed for new types of TCP connections that enabled the channels to stay open between request/response cycles. These were called ‘keep alive’ connections. HTTP 1.1 also allowed for something called pipelining, which promised to get rid of the one-at-a-time system for dealing with requests. Keep alive connections were widely adopted, while pipelining was only ever used by Opera, which is known for using more innovative technology in its browser.
What About SPDY?
Because pipelining wasn’t widely adopted, web page latency still remained an issue. Then, in 2009, Google announced that it had begun work developing SPDY with the goal that it would help speed up the Internet.
SPDY is an open networking protocol intended to be used in addition to HTTP to transport web data. Being an open networking protocol, it establishes rules for how data is shared across networks.
It works by manipulating HTTP traffic to cut back on web page load latency. It does this by assigning a specific identifier called a stream ID to each request. From there, it is able to bypass HTTP’s FIFO system by using just one TCP channel. Multiple requests can be responded to at the same time, freeing up queues and cutting slow loading times. However, nothing will be lost or messed up thanks to that stream ID.
SPDY also reduce web page loading time by compressing the headers that come with requests. Uncompressed, as they come through HTTP, they can vary in size from about 200 bytes to well over 2 KB. It’s not uncommon for request headers to be as large as 700 KB, either. When these come into the server, uncompressed, they eat up bandwidth and the latency can take its toll on a connection.
Redundant headers are also removed during requests. After a header has been established once, it doesn’t need to be sent again and again, and it isn’t, thanks to SPDY.
SPDY requires SSL for security, making it far more secure than HTTP. Not only that, it has been shown in head-to-head tests to be 64% faster than HTTP, although subsequent tests run by a few teams have shown that this really doesn’t make too much of a difference overall, because websites have a lot of different source material that there would still be a bit of latency in use.
Nevertheless, as of November 2014, SPDY is supported by 2.3% of all websites, including Twitter and many of Google’s services.
How Can I Use It?
If you use Google services or Twitter, you are already using SPDY. However, because only a few websites support SPDY, chances are you will not be using it more than HTTP or HTTPS for a long time.
For users with web servers, you can usually implement SPDY without having to alter any web content. For Apache users, there is a SPDY extension that can be installed called mod_SPDY. If you use Nginx, you can apply the SPDY patch. While mod_SPDY and the SPDY patch for Nginx are certainly new and probably confusing, they are not incredibly difficult to install. However, you still will require an SSL certificate. This article by Mohan Ramkumar will show you how to get your very own SSL certificate, for free.
If you’re on a browser and curious about which sites support SPDY, there are apps and add-ons available that show whether it is enabled or not, such as SPDY Indicator available for Chrome and Mozilla Firefox. It displays a small green lightning icon if it is enabled for a specific website, and an optional gray icon if it is not enabled.
Although SPDY may not be faster than HTTP in real world usage, it’s getting there and is already supported by several web browsers, including Chrome/Chromium, Mozilla Firefox, Opera, Amazon Silk, and Safari. While enabling support for SPDY on your own server may be a little complicated at first, you’re paving the way for a new world wide web.
Have any experience with SPDY? Leave a comment below and we’ll chat!