Facebook today has open-sourced a collection of C++ HTTP libraries and an HTTP server that it calls Proxygen.
According to a blog post from Facebook software engineers Alan Frindell and Daniel Sommermann, Proxygen is not designed to replace the C-based Apache or Nginx HTTP servers, but rather to build a high-performance C++ HTTP framework with sensible defaults, including both server and client code to integrate into existing applications.
“Proxygen began as a project to write a customizable, high-performance HTTP(S) reverse-proxy load balancer nearly four years ago,” Frindell and Sommermann wrote. “We initially planned for Proxygen to be a software library for generating proxies, hence the name. But Proxygen has evolved considerably since the early days of the project.”
Facebook decided to build its own HTTP stack to foster the ability to integrate with Facebook’s existing infrastructure, according to the developers. Proxygen is also designed for scaling and code reuse, with more than a dozen internal Facebook systems built on it, including the Haystack photo infrastructure and the Hip-Hop Virtual Machine.
The C++ HTTP stack architecture is split into a four-part abstraction: a session, a codec, a transaction and a handler. These parts work together in serializing and de-serializing HTTP messages, mapping each method from the codec to an HTTP transaction and registering HTTP-specific callbacks from a transaction, according to the documentation.
In terms of other features, Proxygen also supports the SPDY/3 and SPDY/3.1 open networking protocols, and the Facebook engineering team is currently iterating and developing support for HTTP/2.
More information about Proxygen is available on GitHub.