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

Restore previous performance of private RubyGems servers #5826

Merged
merged 7 commits into from
Aug 19, 2022

Conversation

deivid-rodriguez
Copy link
Member

@deivid-rodriguez deivid-rodriguez commented Aug 9, 2022

What was the end-user or developer problem that led to this PR?

Since #5256, resolution for private gem servers not implementing the compact index API need to fetch marshaled gemspecs for ALL gems considered by resolution, in order to fetch their metadata requirements. This is painfully slow.

What is your fix for the problem, implemented in this PR?

My fix is to restore the old optimistic approach of resolving without metadata, and then only if the result is not valid, leverage the work done in #5840 to retry resolution excluding the specs with conflicting metadata requirements.

I added a spec to make sure that we're no longer downloading all gemspecs and also tested this in real life on a private Github server.

Closes #5385.

I leave this as WIP for now until I merge #5840, since this one builds on that. #5840 merged.

Make sure the following tasks are checked

It's explicitly loaded when monkeypatching RubyGems, which we do very
early. So neither autoloading it, nor explicitly loading it anywhere
else is necessary.
It's already included by the parent.
The compact index should not request any marshaled gemspecs whatsoever.
And use RubyGems helpers consistently.
Don't fetch remote metadata eagerly. Instead, resolve optimistically
without metadata, and then check whether the result is valid after
resolution. If not, re-resolve without the invalid candidates.

The second re-resolve could potentially fail again, in that case we'll
accept the error, because the original issue was very rare in any case,
so I imagine needing a second re-resolve should be even more edgy. And
this code should go anyways once custom servers migrate to modern APIs
that provide metadata information.
@deivid-rodriguez deivid-rodriguez marked this pull request as ready for review August 18, 2022 04:46
@deivid-rodriguez deivid-rodriguez merged commit f8c76ea into master Aug 19, 2022
@deivid-rodriguez deivid-rodriguez deleted the fast-custom-servers-again branch August 19, 2022 17:20
deivid-rodriguez added a commit that referenced this pull request Aug 24, 2022
Restore previous performance of private RubyGems servers

(cherry picked from commit f8c76ea)
@vosechu
Copy link

vosechu commented Sep 16, 2022

@deivid-rodriguez Thank you so much! This fixed some problems we were tearing our hair out about! Really appreciate all your hard work!!

@deivid-rodriguez
Copy link
Member Author

No problem, I realized it was a painful thing and there are two many private servers on old APIs. Glad it got fixed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bundler fetches gemspec for every version of every private gem when using github as a source as of 2.3.5
2 participants