Closed mrbbot closed 1 year ago
Latest commit: 6124292c7ec4b0ebc076b515d26ed656e8ed83d0
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
Click here to learn what changesets are, and how to add one.
[Click here if you're a maintainer who wants to add a changeset to this PR](https://github.com/cloudflare/miniflare/new/bcoll/tre-concurrent-requests?filename=.changeset/pink-flowers-lay.md&value=---%0A%22%40fake-scope%2Ffake-pkg%22%3A%20patch%0A---%0A%0A%5BMiniflare%203%5D%20Re-enable%20concurrent%20%60dispatchFetch()%60s%20and%20batch%20proxy%20heap%20frees%20%0A)
In order to fix tests when adding the magic proxy, we restricted
dispatchFetch()
to one concurrent TCP connection. Unfortunately, this prevented long-liveddispatchFetch()
requests.When proxies are garbage collected, we send a network request to
workerd
to free the corresponding entry in theProxyServer
heap. Garbage collection often happens in phases though, freeing lots of objects at once. This caused many concurrent requests toworkerd
(~60 in some tests), leading to many TCP connections being created.This change re-enables using multiple TCP connections, and attempts to address the root cause of the issues we were seeing, by batching frees before sending the network request.