Use unbuffered work queue in the dynamic threadpool to reduce bufferbloat

pull/3/head
Tyler Neely 5 years ago
parent d75aae23cb
commit 4cb1faf299

@ -38,9 +38,14 @@ lazy_static! {
.expect("cannot start a thread driving blocking tasks"); .expect("cannot start a thread driving blocking tasks");
} }
// We want to bound the work queue to make it more // We want to use an unbuffered channel here to help
// suitable as a backpressure mechanism. // us drive our dynamic control. In effect, the
let (sender, receiver) = bounded(MAX_THREADS as usize); // 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 } Pool { sender, receiver }
}; };
} }

Loading…
Cancel
Save