Skip to content

Cache the current Rust version. #652

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

Merged
merged 1 commit into from
Dec 14, 2018
Merged

Conversation

mbrubeck
Copy link
Contributor

Currently, every time the home page is rendered, the web server downloads a TOML file from static.rust-lang.org and parses it to find the current Rust version. This adds a significant amount of latency to the home page.

This patch caches the version in memory for up to 10 minutes. This greatly speeds up home page rendering, at the cost of a 10-minute delay before a new version is reflected on the home page.

@Mark-Simulacrum
Copy link
Member

This seems good to me -- however, a ten minute delay might be a bit unfortunate. Could we perhaps lower that down to around 2 minutes? Ideally we'd also change the code such that the cache refresh happens in the background, i.e., we reply immediately and enqueue the refresh onto a separate thread. That might not be feasible on Heroku (or really all that necessary, though).

@mbrubeck
Copy link
Contributor Author

This seems good to me -- however, a ten minute delay might be a bit unfortunate. Could we perhaps lower that down to around 2 minutes?

Done.

Ideally we'd also change the code such that the cache refresh happens in the background, i.e., we reply immediately and enqueue the refresh onto a separate thread.

Done.

Currently, every time the home page is rendered, the web server
downloads a TOML file from static.rust-lang.org and parses it to find
the current Rust version.  This adds a significant amount of latency to
the home page.

This patch caches the version in memory for up to 10 minutes.  This
greatly speeds up home page rendering, at the cost of a 10-minute delay
before a new version is reflected on the home page.
@Mark-Simulacrum
Copy link
Member

Thanks!

@Mark-Simulacrum Mark-Simulacrum merged commit fd79ee4 into rust-lang:master Dec 14, 2018
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.

2 participants