@@ -88,8 +88,7 @@ the frequency of system calls or the need to pause reading or writing.
8888You should keep these buffers small. Increasing them can help with spiky
8989workloads but it can also backfire because it delays backpressure.
9090
91- * In the new :mod: `asyncio ` implementation, there is no library-level read
92- buffer.
91+ * In the :mod: `asyncio ` implementation, there is no library-level read buffer.
9392
9493 There is a write buffer. The ``write_limit `` argument of
9594 :func: `~asyncio.client.connect ` and :func: `~asyncio.server.serve ` controls its
@@ -98,6 +97,9 @@ workloads but it can also backfire because it delays backpressure.
9897 low-water mark to return. This creates backpressure on coroutines that send
9998 messages.
10099
100+ * In the :mod: `threading ` implementation, there are no library-level buffers.
101+ All I/O operations are performed directly on the :class: `~socket.socket `.
102+
101103* In the legacy :mod: `asyncio ` implementation, there is a library-level read
102104 buffer. The ``read_limit `` argument of :func: `~legacy.client.connect ` and
103105 :func: `~legacy.server.serve ` controls its size. When the read buffer grows
@@ -106,10 +108,7 @@ workloads but it can also backfire because it delays backpressure.
106108 connection.
107109
108110 There is a write buffer. It as controlled by ``write_limit ``. It behaves like
109- the new :mod: `asyncio ` implementation described above.
110-
111- * In the :mod: `threading ` implementation, there are no library-level buffers.
112- All I/O operations are performed directly on the :class: `~socket.socket `.
111+ the :mod: `asyncio ` implementation described above.
113112
114113websockets' buffers
115114...................
@@ -131,11 +130,11 @@ attacks.
131130The behavior of the ``max_queue `` argument of :func: `~asyncio.client.connect `
132131and :func: `~asyncio.server.serve ` varies across implementations.
133132
134- * In the new :mod: `asyncio ` implementation , ``max_queue `` is the high-water mark
135- of a queue of incoming frames. It defaults to 16 frames. If the queue grows
136- larger, the connection stops reading from the network until the application
137- consumes messages and the queue goes below the low-water mark. This creates
138- backpressure on the TCP connection.
133+ * In the :mod: `asyncio ` and :mod: ` threading ` implementations , ``max_queue `` is
134+ the high-water mark of a queue of incoming frames. It defaults to 16 frames.
135+ If the queue grows larger, the connection stops reading from the network until
136+ the application consumes messages and the queue goes below the low-water mark.
137+ This creates backpressure on the TCP connection.
139138
140139 Each item in the queue is a frame. A frame can be a message or a message
141140 fragment. Either way, it must be smaller than ``max_size ``, the maximum size
@@ -151,7 +150,3 @@ and :func:`~asyncio.server.serve` varies across implementations.
151150 Text messages are decoded before they're added to the queue. Since Python can
152151 use up to 4 bytes of memory per character, the queue may use up to ``4 *
153152 max_size * max_queue `` bytes of memory. By default, this is 128 MiB.
154-
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.
0 commit comments