OpenAICloudflare Developer PlatformApr 9, 2026, 12:00 AM

Workers - Relaxed simultaneous connection limiting for Workers

A condensed section focused on the key takeaways first.

Original Post

Quick Digest

Summary

A condensed section focused on the key takeaways first.

openaienmodel: gpt-5-mini-2025-08-07

Workers - Relaxed simultaneous connection limiting for Workers

Key Points

  • Six-connection limit now applies only while waiting for response headers
  • Connections freed when response headers arrive; body reads no longer count
  • Eliminates spurious cancellations and 'Response closed due to connection limit' errors

Summary

Cloudflare relaxed the Workers simultaneous open-connection limit. Previously each Worker invocation counted up to six open connections for their entire lifetime (including while reading the response body). Now a connection is freed as soon as response headers arrive, so the six-connection cap only applies to connections that are in the initial "waiting for headers" phase.

Key Points

  • Limit now counts only connections that are waiting for initial response headers, not the entire connection lifetime.
  • Connections are freed as soon as response headers arrive; subsequent body reads do not count against the six-connection quota.
  • This change removes the fragile deadlock-avoidance heuristic that could cancel active connections (e.g., during brief internal pauses such as gzip decompression).
  • Workers can now have many more concurrently open connections without queueing, provided no more than six are simultaneously waiting for headers.

Impact for engineers

  • Reduced spurious "Response closed due to connection limit" errors and fewer unexpected cancellations.
  • No mandatory code changes; long-lived or streaming responses are less likely to be penalized.
  • If you create many outbound requests, prefer designs that allow upstreams to send headers promptly (or stream headers early) so requests do not accumulate in the waiting-for-headers queue.

Full Translation

Translations

A translation section that keeps the flow of the original article.

openaijamodel: gpt-5-mini-2025-08-07

Workers — 同時接続制限の緩和

Workers — 同時接続制限の緩和

公開日: 2026-04-09

CloudflareのChangelog: 更新と改善のお知らせです。

この変更により、同時に開ける接続数の制限が緩和されました。従来は、各 Worker 呼び出しにつき接続のライフタイム全体(レスポンスボディの読み取り中も含む)で同時に6つまでに制限されていました。現在は、レスポンスヘッダーが到着した時点で接続は解放されるため、6接続の制限は初期の「"waiting for headers"」フェーズに同時に存在できる接続数のみを制約します。

Before / After

  • Before: 新しい接続は、以前の接続が完全に完了するまでブロックされていました。
  • After: レスポンスヘッダーが到着した時点で新しい接続が開始できます。

この変更により、初期レスポンス待ちの接続が同時に6つ以下である限り、Worker はそれ以外の多くの接続を同時にオープンできるようになり、キューイングが発生しにくくなります。これにより、ランタイムがデッドロックを防ぐためにスタックした接続をキャンセルして発生していた「Response closed due to connection limit exception」を回避できます。

従来、ランタイムはデッドロック回避アルゴリズムとして各オープン接続の I/O 活動を監視していました。6つすべての接続が一時的にアイドルに見えると、ランタイムは新しいリクエストのために最も最近使用されていない接続をキャンセルしてスペースを作っていました。このヒューリスティックは実際には脆弱でした。例えば、レスポンスに Content-Encoding: gzip が使用されている場合、ランタイム内部の展開処理により読み取りと書き込み操作の間に短いギャップが生じます。これらのギャップの間、接続は Worker によって実際には読み取り中であっても停止しているように見えることがあります。複数の接続が同時にこのギャップに遭遇すると、正常に動作している接続が誤ってキャンセルされる可能性がありました。

ランタイムが接続をカウントするのを「waiting-for-headers」フェーズのみに限定することで(このフェーズではランタイムが完全に制御しており、接続がアクティブかどうかに曖昧さがない)、この種のバグは完全に解消されます。

  • Before: 内部の短い一時停止中に接続がキャンセルされる可能性がありました。
  • After: 内部の一時停止があっても接続は正常に完了します。

関連リソース

  • API
  • Directory
  • Sponsorships
  • Open Source
  • Support
  • Help Center
  • System Status
  • Compliance
  • GDPR

© 2026 Cloudflare, Inc. | Privacy Policy | Terms of Use | Report Security Issues | Trademark | Cookie Settings

Was this helpful? Yes / No