Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Miniflare 3] Re-enable concurrent dispatchFetch()s and batch proxy heap frees #713

Merged
merged 2 commits into from Oct 10, 2023

Conversation

mrbbot
Copy link
Contributor

@mrbbot mrbbot commented Oct 10, 2023

In order to fix tests when adding the magic proxy, we restricted dispatchFetch() to one concurrent TCP connection. Unfortunately, this prevented long-lived dispatchFetch() requests.

When proxies are garbage collected, we send a network request to workerd to free the corresponding entry in the ProxyServer heap. Garbage collection often happens in phases though, freeing lots of objects at once. This caused many concurrent requests to workerd (~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.

@changeset-bot
Copy link

changeset-bot bot commented Oct 10, 2023

⚠️ No Changeset found

Latest commit: 6124292

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

In order to fix tests when adding the magic proxy, we restricted
`dispatchFetch()` to one concurrent TCP connection. Unfortunately,
this prevented long-lived `dispatchFetch()` requests.

When proxies are garbage collected, we send a network request to
`workerd` to free the corresponding entry in the `ProxyServer` heap.
Garbage collection often happens in phases though, freeing lots of
objects at once. This caused many concurrent requests to `workerd`
(~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.
@mrbbot mrbbot force-pushed the bcoll/tre-concurrent-requests branch from b7b2bf1 to 87f01cd Compare October 10, 2023 11:44
@mrbbot mrbbot changed the title [WIP] Concurrent request debugging [Miniflare 3] Re-enable concurrent dispatchFetch()s and batch proxy heap frees Oct 10, 2023
@mrbbot mrbbot marked this pull request as ready for review October 10, 2023 11:45
@mrbbot mrbbot requested a review from a team October 10, 2023 11:45
@mrbbot mrbbot merged commit 6e0926d into tre Oct 10, 2023
8 checks passed
@mrbbot mrbbot deleted the bcoll/tre-concurrent-requests branch October 10, 2023 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants