Skip to content

start caching build-status json#3244

Open
syphar wants to merge 1 commit intorust-lang:mainfrom
syphar:cache-status-json
Open

start caching build-status json#3244
syphar wants to merge 1 commit intorust-lang:mainfrom
syphar:cache-status-json

Conversation

@syphar
Copy link
Member

@syphar syphar commented Mar 13, 2026

Seeing some current request stats (~60 rps in peaks), I thought about this again.

Main users are:

  • crates.io frontend to show links or not.
  • shields.io

I believe we can cache this the same way we cache docs, release lists, details etc.

( also i created a PR to crates.io for an optimization rust-lang/crates.io#13174 )

@syphar syphar self-assigned this Mar 13, 2026
@syphar syphar requested a review from a team as a code owner March 13, 2026 17:13
@github-actions github-actions bot added the S-waiting-on-review Status: This pull request has been implemented and needs to be reviewed label Mar 13, 2026
@syphar
Copy link
Member Author

syphar commented Mar 13, 2026

Though, thinking about it,

if we can cache or not probably depends on the use-case?
if people use it to get an actual live-status?

@GuillaumeGomez
Copy link
Member

Not sure it's a good idea to cache a build-status indeed. ^^'

"doc_status": rustdoc_status,
}));
let mut response = Json(serde_json::json!({
"version": matched_release.release.version,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Broken indent btw. :p

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's rustfmt 😅

@syphar
Copy link
Member Author

syphar commented Mar 14, 2026

Not sure it's a good idea to cache a build-status indeed. ^^'

My thought here is:
everything that changes the build status in any important way also purges the CDN for this key.
So, it's the same cache we're using for crate-details, or the /latest/ path.

And that takes ~250ms globally in fastly's network.

So for the currently known use-cases, that's totally fine, since we don't need in-progres status.

I probably should think through some of the in-progress responses for this, but my hunch is that it's fine, assuming the invalidation.

high level, after the build is finished, the status only rarely changes, which makes it a good candidate for caching. And prefer the CDN responding in these cases over having to run more webservers ( and databases ) over time.

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

Labels

S-waiting-on-review Status: This pull request has been implemented and needs to be reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants