Skip to content

Commit 160361e

Browse files
Copilotaaugustin
andcommitted
Update memory.rst to correctly document max_queue in threading implementation
Co-authored-by: aaugustin <[email protected]>
1 parent 5283a6e commit 160361e

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

docs/topics/memory.rst

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,14 @@ and :func:`~asyncio.server.serve` varies across implementations.
152152
use up to 4 bytes of memory per character, the queue may use up to ``4 *
153153
max_size * max_queue`` bytes of memory. By default, this is 128 MiB.
154154

155-
* In the :mod:`threading` implementation, there is no queue of incoming
156-
messages. The ``max_queue`` argument doesn't exist. The connection keeps at
157-
most one message in memory at a time.
155+
* In the :mod:`threading` implementation, ``max_queue`` has the same semantics
156+
as in the new :mod:`asyncio` implementation. It is the high-water mark of a
157+
queue of incoming frames. It defaults to 16 frames. If the queue grows larger,
158+
the connection stops reading from the network until the application consumes
159+
messages and the queue goes below the low-water mark. This creates backpressure
160+
on the TCP connection.
161+
162+
Each item in the queue is a frame. A frame can be a message or a message
163+
fragment. Either way, it must be smaller than ``max_size``, the maximum size
164+
of a message. The queue may use up to ``max_size * max_queue`` bytes of
165+
memory. By default, this is 16 MiB.

0 commit comments

Comments
 (0)