Skip to content

Latest commit

 

History

History
34 lines (26 loc) · 1.54 KB

py-thread-pools.rst

File metadata and controls

34 lines (26 loc) · 1.54 KB

Thread pools

The actual sending and receiving of packets is done by separate C threads. Each stream is associated with a thread pool, which is a pool of threads able to process its packets. See the performance guidelines <perf-thread-pool> for advice on how many threads to use.

There is one important consideration for deciding whether streams share a thread pool: if a received stream is not being consumed, it may block one of the threads from the thread pool1. Thus, if several streams share a thread pool, it is important to be responsive to all of them. Deciding that one stream is temporarily uninteresting and can be discarded while listening only to another one can thus lead to a deadlock if the two streams share a thread pool with only one thread.


  1. This is a limitation of the current design that will hopefully be overcome in future versions.