What the $%@! is SPDY

Posted danhuang

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了What the $%@! is SPDY相关的知识,希望对你有一定的参考价值。

You may know about SPDY, an experimental protocol for a faster webhttp://www.chromium.org/spdy/spdy-whitepaper announced by Google in 2009. SPDY is now supported by two major browsers (Google Chrome and Mozilla Firefox) and it’s running on most of Google’s servers (also soon to be supported by nginx).

The main goal of SPDY is reducing the latency of web pages by multiplexing multiple http streams into one TCP connection and compressing http headers.

So instead of creating a TCP connection for each http request (like styles, scripts, images, or even ajax), SPDY-enabled browser will hold only one connection with the server.



source: http://www.igvita.com/2011/10/20/faster-web-vs-tcp-slow-start

Your server can tell the browser that it supports SPDY in two ways: setting the ‘Alternate-Protocol’ header, or by using a TLS handshake extension NPN (Next Protocol Negotiation). In the second case the server will send the supported protocols (i.e., SPDY/2 HTTP/1.1 HTTP/1.0) to browser before any data transfer will be performed, and the browser will choose the protocol that is preferable for the client.

You can learn more about SPDY by examing the protocol specification:http://www.chromium.org/spdy/spdy-protocol/spdy-protocol-draft2 

Node.js and SPDY

The growing interest in both the SPDY protocol and Node.js created the need for a stable Node.js SPDY module when the first version was released last year. There were a number of issues with this first implementation: it was buggy, it did not support the default node.js builds, and it was incompatible with popular frameworks (only partial express support, and no socket.io support at all). Despite all of these issues it still attracted considerable some attention from the Node.js community.

Before continuing development on node-spdy it was clear that node.js core needed to be improved: the tls module was lacking NPN support, and there was no zlib functionality. While adding NPN callbacks to node was quite simple, I found that almost every OS has old SSL libraries without support for it. That’s why latest node version bundles openssl in it’s deps/ folder. Thanks to Isaac Z. Schlueter, zlib module was added in 0.6.0 version of node.js, and required only a little patching: it was missing stream dictionary support.

With all that working out of the box (only in 0.7.0-pre version of node now) I decided to start developing a completely new stable node-spdy version. You can take a look at what I’ve done so far at https://github.com/indutny/node-spdy . Note that to test it you’ll need to build v0.7.0-pre of node.js (currently at github’s master branch):

  git clone git://github.com/joyent/node.git
  cd node
  [sudo] ./configure
  [sudo] make
  [sudo] make install

I have one running SPDY server running at https://spdy-twitlog.indutny.com/. It’s demonstrating socket.io + express support of node-spdy module.



Features & Roadmap

Implemented:

  • Node.js compatible interface (same as for require(‘http’).Server )
  • Opening/closing streams
  • Fallback to https
  • Basic flow management (no WINDOW management so far, that means .pause() and .resume() will just buffer data internally instead of sending WINDOW_UPDATE to client)
  • Protocol errors handling
  • Stream scheduler (for priority management)
  • Push streams

Roadmap:

  • WINDOW_UPDATE and INITIAL_WINDOW_SIZE
  • Fixing bugs

以上是关于What the $%@! is SPDY的主要内容,如果未能解决你的问题,请参考以下文章

The truth is what it is, not what you see

What is the reason that a likelihood function is not a pdf?

What is the C4 model?

What is the C4 model?

What is the C4 model?

UVA10056 What is the Probability概率