-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
limit parallel requests to registry during resolution #564
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this would be a good candidate for a .yarnrc.yml configuration. As you said the npm registry can handle this many open connections and it should be the most used registry. Limiting the default use case for a stress case should be avoided IMO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can incorporate it into the .yarnrc.yml configuration and update the PR.
My one concern about not limiting the default is companies do use private npm registries or proxies in front of npm. This took down our internal nexus proxy and made it unusable. Lucky for me, we brought the server back up before it caused a major disruption. If any engineer decides to create a new package and use yarn v2 it will cause the same problem unless they remember to set this value. If a lockfile exists this logic is not hit, so the only performance hit is when packages are updated or the lockfile is deleted. In the case of updating packages the amount of requests to the registry is typically small enough to not see any slow downs.
Does it make sense to still have an upper boundary even for npm? In theory, the current algorithm could make over a 1000 connections simultaneous depending on the packages being resolved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How did v1 behave?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yarn v1 limited concurrent requests to the npm registry at 8 but it is configurable via the .yarnrc file by setting the network-concurrency param.
The rest is a description with code links for how this behaviour was discovered.
From what i can tell the request-manager.js had a queue for both metadata and tarball requests that had a configurable limit which default to 8 via the constant NETWORK_CONCURRENCY. It is configurable via the .yarnrc file with the value network-concurrency code link
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well then it sounds like we should merge this. I would even argue to use the old default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can change the default to 8, would you like me to expose this as a configuration option as well? If you do want the configuration option, would you like it in this PR or as a follow on?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A separate PR is fine for me. Wdyt @arcanis ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, let's keep this in a separate PR (and we can also make the fetch concurrency configurable) 👍
Let's also keep 10 - the Yarn codebase even used to have 16 but switched to 8 due to some weird bugs in the unpacking logic. Since we don't unpack anymore we don't need to be too cautious there.