BT

Facebook Open Sources Proxygen, an HTTP Framework Supporting SPDY 3.1

by Abel Avram on Nov 06, 2014 |

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

Relevance
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
General Feedback
Bugs
Advertising
Editorial
Marketing
InfoQ.com and all content copyright © 2006-2016 C4Media Inc. InfoQ.com hosted at Contegix, the best ISP we've ever worked with.
Privacy policy
BT

We notice you're using an ad blocker

We understand why you use ad blockers. However to keep InfoQ free we need your support. InfoQ will not provide your data to third parties without individual opt-in consent. We only work with advertisers relevant to our readers. Please consider whitelisting us.