mirror of
https://github.com/async-rs/async-std.git
synced 2025-04-26 10:16:49 +00:00
Use unbuffered work queue in the dynamic threadpool to reduce bufferbloat
This commit is contained in:
parent
d75aae23cb
commit
4cb1faf299
1 changed files with 8 additions and 3 deletions
|
@ -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…
Reference in a new issue