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

Very slow HTTP connection to crates.io #22

Closed
dometto opened this issue Feb 18, 2020 · 2 comments
Closed

Very slow HTTP connection to crates.io #22

dometto opened this issue Feb 18, 2020 · 2 comments

Comments

@dometto
Copy link
Contributor

dometto commented Feb 18, 2020

Locally, the rust specs are taking a looong time to run. This is because the RustLang#last_version method is doing an HTTP request to crates.io which is slow, and sometimes times out, causing the specs to fail.

Weirdly, I am:

  • Not seeing this issue when I just curl e.g. https://crates.io/api/v1/crates/log
  • Am seeing when I use Ruby's Net::HTTP instead of http-rb.
  • Not seeing it on Travis

Possibly some low-level Ruby issue on my system? @bartkamphorst could you see how it works locally for you?

As mentioned in #17, the specs should be mocking the http requests anyway. But this issue has got me thinking: what should we do in case a last_version HTTP request times out? Currently it just returns nil. Should we be trying to cache last_version calls (possibly in a separate Moneta store)? If so, how long should it take for a cached result to expire?

@dometto
Copy link
Contributor Author

dometto commented Feb 18, 2020

Can confirm this must be a ruby issue of some kind, as I don't get the timeouts when running the app with jruby.

Incidentally, the app takes up between 600-700MB of RAM with JRuby. 😆 (But runs nice and fast!)
(EDIT: actually, telling JRuby to use less memory works fine -- bundle exec jruby -J-Xmx200m bin/launch.rb causes only ~320MB memory use. Presumably JRuby is just utilizing as much memory as possible for the workers when its allowed.)

@dometto
Copy link
Contributor Author

dometto commented Sep 18, 2020

what should we do in case a last_version HTTP request times out? Currently it just returns nil. Should we be trying to cache last_version calls (possibly in a separate Moneta store)? If so, how long should it take for a cached result to expire?

In last_version, we are currently rescuing timeouts for Python and Rust, and rescuing StandardError for Ruby. A StandarError will result if, due to a timeouts, the Gem::SpecFetcher fails to return a spec. So we're all good on this front.

@dometto dometto closed this as completed Sep 18, 2020
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

No branches or pull requests

1 participant