News for hackers. Stuff that matters.
Re:Proxygen, Facebook's C++ HTTP Framework by amelius on Wednesday November 05, 2014 @03:02PM (#8563943)
Skimming through the article, it seems to me that this server spawns a thread per connection, is that correct?
Re:Proxygen, Facebook's C++ HTTP Framework by dcsommer on Wednesday November 05, 2014 @03:21PM (#8564038)
We use a very different model actually. Since spawning OS threads is expensive, we opted for the popular nonblocking-IO approach. Each worker thread (usually 1 per core on the CPU) is given connections in a round robin fashion from the listening socket. The worker thread runs an event loop processing events on the accepted socket.
Re:Proxygen, Facebook's C++ HTTP Framework by amelius on Wednesday November 05, 2014 @05:27PM (#8564648)
What kind of programming technique did you use to implement the handling of the protocols? Did you implement them as finite-state machines, or did you use coroutines, or some other technique?

Do you think that C++ is a well suited language for this kind of processing? Is it possible to say, now this project is in a mature state, that other languages (e.g. Rust) could have helped make your implementation simpler?

Re:Proxygen, Facebook's C++ HTTP Framework by seasonedschemer on Wednesday November 05, 2014 @06:42PM (#8564952)
Hey, I'm a Software Engineer on Proxygen as well. Proxygen heavily relies on folly's buffer management abstractions such as IOBuf (https://github.com/facebook/folly/blob/master/folly/io/IOBuf...) and Cursor (https://github.com/facebook/folly/blob/master/folly/io/Curso...). Protocol parsing implementation uses folly::io::Cursor to safely read byte sequences across non-contiguous buffers. Errors during parsing are wrapped up in Result types (https://github.com/facebook/proxygen/blob/master/proxygen/li...) which take an inspiration from Rust. Such constructs simplify our implementation to a reasonable extent and are still low-level enough to extract performance.
Re:Proxygen, Facebook's C++ HTTP Framework by cbsmith on Saturday November 08, 2014 @03:40AM (#8576370)
Note: as google discovered a few years ago, round-robining the connections is probably less than ideal.