Skip to content

Commit 459bc0f

Browse files
committed
Update simultaneous open connections docs for slot-release-on-headers
The Workers runtime now releases connection slots when response headers arrive, rather than when the response body is fully consumed. This means the 6-connection limit only constrains how many connections can be in the 'waiting for headers' phase simultaneously. Remove documentation of stall detection and forced connection cancellation (Response closed due to connection limit), as this behavior is no longer observable with the new slot release timing. Keep the response.body.cancel() advice for memory management. Add a changelog entry for the change.
1 parent 8cf3d2a commit 459bc0f

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
title: Relaxed simultaneous connection limiting
3+
description: The six-connection limit now only applies while waiting for response headers, allowing Workers to maintain more open connections simultaneously.
4+
date: 2026-04-09
5+
---
6+
7+
The [simultaneous open connections limit](/workers/platform/limits/#simultaneous-open-connections) has been relaxed. Previously, each Worker invocation was limited to six open connections at a time for the entire lifetime of each connection, including while reading the response body. Now, a connection slot is freed as soon as response headers arrive, so the six-connection limit only constrains how many connections can be in the initial "waiting for headers" phase simultaneously.
8+
9+
This means Workers can now have many more connections open at the same time without queueing, as long as no more than six are waiting for their initial response. This eliminates the `Response closed due to connection limit` exception that could previously occur when the runtime canceled stalled connections to prevent deadlocks.

src/content/docs/workers/platform/limits.mdx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ Using global [`fetch()`](/workers/runtime-apis/fetch/) to call another Worker on
200200

201201
## Simultaneous open connections
202202

203-
Each Worker invocation can open up to six simultaneous connections. The following API calls count toward this limit:
203+
Each Worker invocation can have up to six connections simultaneously waiting for response headers. The following API calls count toward this limit while the initial connection is being established and the server has not yet responded:
204204

205205
- `fetch()` method of the [Fetch API](/workers/runtime-apis/fetch/)
206206
- `get()`, `put()`, `list()`, and `delete()` methods of [Workers KV namespace objects](/kv/api/)
@@ -211,9 +211,9 @@ Each Worker invocation can open up to six simultaneous connections. The followin
211211

212212
Outbound WebSocket connections also count toward this limit.
213213

214-
Once six connections are open, the runtime queues additional attempts until an existing connection closes. The runtime may close stalled connections (those not actively reading or writing) with a `Response closed due to connection limit` exception.
214+
Once response headers arrive for a connection, it no longer counts toward the six-connection limit. This means a Worker can have many connections open simultaneously, as long as no more than six are in the initial "waiting for headers" phase at the same time. If a seventh connection is attempted while six are already waiting for headers, it is queued until one of the existing connections receives its response headers.
215215

216-
If you use `fetch()` but do not need the response body, call `response.body.cancel()` to free the connection:
216+
If you use `fetch()` but do not need the response body, calling `response.body.cancel()` is still good practice to free memory:
217217

218218
```ts
219219
const response = await fetch(url);
@@ -227,8 +227,6 @@ if (response.statusCode <= 299) {
227227
}
228228
```
229229

230-
If the system detects a deadlock (pending connection attempts with no in-progress reads or writes), it cancels the least-recently-used connection to unblock the Worker.
231-
232230
:::note
233231

234232
The runtime measures simultaneous open connections from the top-level request. Workers triggered via [Service bindings](/workers/runtime-apis/bindings/service-bindings/) share the same connection limit.

0 commit comments

Comments
 (0)