From 4cb1faf299a3e28df87f5bc66bb8336d09fb3cbd Mon Sep 17 00:00:00 2001 From: Tyler Neely Date: Fri, 9 Aug 2019 12:06:26 +0200 Subject: [PATCH] Use unbuffered work queue in the dynamic threadpool to reduce bufferbloat --- src/task/blocking.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/task/blocking.rs b/src/task/blocking.rs index b22117ad..252ec2f9 100644 --- a/src/task/blocking.rs +++ b/src/task/blocking.rs @@ -38,9 +38,14 @@ lazy_static! { .expect("cannot start a thread driving blocking tasks"); } - // We want to bound the work queue to make it more - // suitable as a backpressure mechanism. - let (sender, receiver) = bounded(MAX_THREADS as usize); + // We want to use an unbuffered channel here to help + // us drive our dynamic control. In effect, the + // kernel's scheduler becomes the queue, reducing + // the number of buffers that work must flow through + // before being acted on by a core. This helps keep + // latency snappy in the overall async system by + // reducing bufferbloat. + let (sender, receiver) = bounded(0); Pool { sender, receiver } }; }