feat(server): Rewrite the accept loop into a custom thread pool.
This is a modified and specialized thread pool meant for managing an acceptor in a multi-threaded way. A single handler is provided which will be invoked on each stream. Unlike the old thread pool, this returns a join guard which will block until the acceptor closes, enabling friendly behavior for the listening guard. The task pool itself is also faster as it only pays for message passing if sub-threads panic. In the optimistic case where there are few panics, this saves using channels for any other communication. This improves performance by around 15%, all the way to 105k req/sec on my machine, which usually gets about 90k. BREAKING_CHANGE: server::Listening::await is removed.
This commit is contained in:
10
src/lib.rs
10
src/lib.rs
@@ -1,5 +1,5 @@
|
||||
#![feature(core, collections, hash, io, os, path, std_misc,
|
||||
slicing_syntax, box_syntax)]
|
||||
slicing_syntax, box_syntax, unsafe_destructor)]
|
||||
#![deny(missing_docs)]
|
||||
#![cfg_attr(test, deny(warnings))]
|
||||
#![cfg_attr(test, feature(alloc, test))]
|
||||
@@ -130,12 +130,16 @@ extern crate "rustc-serialize" as serialize;
|
||||
extern crate time;
|
||||
extern crate url;
|
||||
extern crate openssl;
|
||||
#[macro_use] extern crate log;
|
||||
#[cfg(test)] extern crate test;
|
||||
extern crate "unsafe-any" as uany;
|
||||
extern crate cookie;
|
||||
extern crate unicase;
|
||||
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
|
||||
#[cfg(test)]
|
||||
extern crate test;
|
||||
|
||||
pub use std::old_io::net::ip::{SocketAddr, IpAddr, Ipv4Addr, Ipv6Addr, Port};
|
||||
pub use mimewrapper::mime;
|
||||
pub use url::Url;
|
||||
|
||||
Reference in New Issue
Block a user