BT

New Early adopter or innovator? InfoQ has been working on some new features for you. Learn more

Facebook Open Sources Proxygen, an HTTP Framework Supporting SPDY 3.1

| by Abel Avram on Nov 06, 2014. Estimated reading time: 1 minute |

The idea behind Proxygen is not to replace Apache but having the ability to create a specialized high-performance web server that can be embedded into existing applications providing web services. Facebook initially started to build a proxy (hence the name) server in 2011, and now they are open sourcing it after the project evolved and has been tested in production for a number of years.

Why not start with Apache or nginx or another server? Facebook provided a number of reasons:

  • Ability to integrate with their existing infrastructure and tooling (Thrift, ODS)
  • Creating an event-driven library that would be used by different internal projects (Haystack, HHVM, load balancer, etc.)
  • According to Facebook, their previous HTTP infrastructure had reach some scalability limits and required “lots of workarounds”, so they wanted something that can be developed internally as desired.
  • A number of features were missing in existing HTTP servers at that time: SPDY, WebSockets, HTTP/1.1 (keep-alive), TLS false start, and specific load-scheduling algorithms.

Proxygen uses the following concepts: transaction, session, codec, and handler. A transaction represents a request-response pair exchanged between a client and a server. A sequence of such related transactions represents a session. Bytes coming from the wire are parsed into objects by a codec which associates them with a transaction. The message is eventually passed to a handler for actual processing. While it is possible to interact with the framework at this low level of codecs and transactions, developers are suggested to use higher level abstractions via an API.

Proxygen relies on

  • Folly – an open source library of C++11 components used internally by Facebook and including among others a code benchmarking framework, endian conversion primitives, optimized strings and vectors, JSON serializer, and others.
  • FBThrift – an Apache Trift branch.

Proxygen has support for SPDY 3.1 and is adding support for HTTP/2. During an in-house benchmark run by Facebook on a 32 logical core Xeon CPU E5-2670 @ 2.60GHz with 16 GB of RAM, a Proxygen echo server served up to 304,197 in-memory GET requests/sec over SPDY 3.1.

The source code released on GitHub has been tested on Ubuntu 14.04, but Facebook considers it safe to be run on other systems, without specifying which.

Rate this Article

Adoption Stage
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Discuss

Login to InfoQ to interact with what matters most to you.


Recover your password...

Follow

Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.

Like

More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.

Notifications

Stay up-to-date

Set up your notifications and dont miss out on content that matters to you

BT