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

Ensure that star rating reprocessing does not incur online lookup requests #32273

Merged
merged 3 commits into from
Mar 10, 2025

Conversation

bdach
Copy link
Collaborator

@bdach bdach commented Mar 7, 2025

Yesterday after the lazer release there was a bit of a spike in the number of osu-web requests pointed at /api/v2/beatmaps/lookup specifically. The most likely reason for this is that prior to this commit, the star rating recalculation was fully performed by the BeatmapUpdater.Process() flow.

This process does full metadata lookups, and while it will attempt to use the local online.db metadata cache, it will also fall back to API requests if the local metadata fetch fails. While that means that the local cache likely saved us from a doomsday scenario here, it also is the case that all of that metadata lookup stuff is entirely unnecessary when wanting to just update star ratings.

Therefore, this splits out only the part relevant to star ratings as a separate background process, so that it can run completely locally.

…uests

Yesterday after the lazer release there was a bit of a spike in the
number of osu-web requests pointed at `/api/v2/beatmaps/lookup`
specifically. The most likely reason for this is that prior to this
commit, the star rating recalculation was fully performed by the
`BeatmapUpdater.Process()` flow.

This process does full metadata lookups, and while it *will* attempt
to use the local `online.db` metadata cache, it *will* also fall back to
API requests if the local metadata fetch fails. While that means that
the local cache likely saved us from a doomsday scenario here, it *also*
is the case that all of that metadata lookup stuff is *entirely
unnecessary* when wanting to just update star ratings.

Therefore, this splits out only the part relevant to star ratings
as a separate background process, so that it can run completely
locally.
@bdach bdach added type:online realm deals with local realm database area:difficulty labels Mar 7, 2025
@bdach bdach requested a review from peppy March 7, 2025 10:01
@bdach bdach self-assigned this Mar 7, 2025
peppy
peppy previously approved these changes Mar 10, 2025
@peppy
Copy link
Member

peppy commented Mar 10, 2025

@bdach please double-check 7ca9d83 for me, couldn't see this and leave it (we've adjusted this server-side due to overheads, so there's good precedence for doing this here).

@bdach
Copy link
Collaborator Author

bdach commented Mar 10, 2025

Seems fine. If we're doing changes like that I've also pushed in 6b1472b which pulls the actual diffcalc out of the realm transaction. I'm not sure this is going to do anything for issues like #32255, though; on one of the huge databases I have locally I get a huge lagspike on intro and it's seemingly caused by the resetting of the star ratings (which take multiple seconds) rather than the subsequent diffcalc itself.

@peppy peppy self-requested a review March 10, 2025 10:31
@peppy peppy merged commit 775cdc0 into ppy:master Mar 10, 2025
8 of 9 checks passed
@bdach bdach deleted the star-rating-updates-without-online-hits branch March 10, 2025 10:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants