Skip to content

Tag: http

Spdy – A .NET client

Protocols, more protocols! I love deep-diving into them, and have wanted to explore the secret mysteries of HTTP/2 and gRPC ever since they were released some years ago, but havn’t had any particular reasons to do so, until now.

Kubernetes and the Streaming APIs

You have probably used them many times, the streaming functions exposed by the Kubernetes API Server; exec, port-forward, attach, logs etc. They all stream data back and forth between your local host and containers running on a Kubernetes node. They more or less support one data transport layer; Spdy (…and partly WebSocket) (…and sooooon HTTP/2).

Spdy

Spdy is a deprecated Chromium project that has been superseeded by HTTP/2. The Spdy protocol specification layed the foundation for the HTTP/2 specification and therefor they naturally share a lot of concepts.

Spdy was born due to the increasing usage of network bandwidth and need for low latency communication by modern web applications where HTTP/1.1 (and WebSocket) become bottle necks.

Web applications today depend on a lot of resources, but HTTP/1.1 only supports one request at a time per connection. This has somewhat been mitigated by browsers creating more connections towards the web servers, which is not very effecient considering the growth rate of consumer ip traffic. At best, this is a work around which at the end leads to socket starvation problems for the web servers.

Other limitations are one-way-communication initiation (client to server), redundant and uncompressed metadata (headers), downstream throttling and head-of-line blocking.

Spdy <3 .NET

Up until now, there hasn’t been a Spdy implementation available for .NET (as far as I can tell), and since I needed a reliable, duplex communication transfer protocol to integrate my upcoming project, Port, with Kubernetes’ port-forward API, I decided to implement Spdy, a high level client / server implementation of the 3.1 protocol specification!

As with the Kafka Test Framework, Spdy also utilizes System.IO.Pipelines to minimize buffer copying resulting in lower latency and CPU usage. It also comes with an ASP.NET Core middleware (soon) enabling upgrades of HTTP/1.1 requests to Spdy similar to how requests can be upgraded to WebSocket.

For a sneak peek of the Kubernetes port-forward integration using Spdy, head over to Port’s repository and the Spdy port forwarder.

Leave a Comment