ClaudeCloudflare 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.

claudeenmodel: claude-sonnet-4-20250514

Workers Connection Limiting Relaxed - Improved Concurrent Request Handling

Key Points

  • Six-connection limit now only applies during header-waiting phase
  • Eliminated spurious connection cancellations from deadlock detection
  • Workers can maintain significantly more concurrent connections

Summary

Cloudflare Workers has relaxed its simultaneous connection limiting mechanism to improve performance and eliminate spurious connection cancellations. The six-connection limit now only applies during the "waiting for headers" phase instead of the entire connection lifetime.

Key Points

  • Connection counting changed: Connections are now freed as soon as response headers arrive, rather than after the full response is processed
  • Increased concurrency: Workers can maintain many more simultaneous connections without queueing, as long as no more than six are waiting for initial response headers
  • Eliminated spurious cancellations: Removed the fragile deadlock avoidance algorithm that could incorrectly cancel active connections during brief internal pauses (e.g., gzip decompression gaps)
  • No more connection limit exceptions: The Response closed due to connection limit error should no longer occur due to false positive stall detection
  • Improved reliability: Connections complete normally regardless of internal processing pauses

Full Translation

Translations

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

claudejamodel: claude-sonnet-4-20250514

Workers - Workersの同時接続制限の緩和

Workersの同時接続制限の緩和

2026年4月9日

Workers

同時オープン接続の制限が緩和されました。

以前は、各Workerの呼び出しにおいて、レスポンスボディの読み取り中を含む接続の全ライフタイムにわたって、同時に6つのオープン接続に制限されていました。現在は、レスポンスヘッダーが到着するとすぐに接続が解放されるため、6接続制限は「ヘッダー待ち」の初期フェーズで同時に実行できる接続数のみを制約します。

変更前: 新しい接続は、以前の接続が完全に完了するまでブロックされる

変更後: レスポンスヘッダーが到着するとすぐに新しい接続を開始できる

これにより、初期レスポンスを待機している接続が6つを超えない限り、Workersはキューイングなしで同時により多くの接続を開くことができるようになりました。

この変更により、ランタイムがデッドロックを防ぐために停止した接続をキャンセルした際に発生していた「Response closed due to connection limit」例外が解消されます。

以前は、ランタイムは各オープン接続のI/Oアクティビティを監視するデッドロック回避アルゴリズムを使用していました。6つの接続すべてが一時的にでもアイドル状態に見える場合、ランタイムは新しいリクエストのためのスペースを作るために、最も最近使用されていない接続をキャンセルしていました。

実際には、このヒューリスティックは脆弱でした。例えば、レスポンスがContent-Encoding: gzipを使用している場合、ランタイムの内部解凍により読み取りと書き込み操作の間に短いギャップが生じます。これらのギャップの間、Workerによってアクティブに読み取られているにもかかわらず、接続は停止しているように見えました。複数の接続が同時にこれらのギャップに遭遇すると、ランタイムは正常に動作している接続を誤ってキャンセルする可能性がありました。

ヘッダー待ちフェーズでのみ接続をカウントすることで(この段階ではランタイムが完全に制御し、接続がアクティブかどうかについて曖昧さがない)、このクラスのバグは完全に排除されます。

変更前: 短い内部一時停止中に接続がキャンセルされる可能性があった

変更後: 内部一時停止に関係なく接続が正常に完了する