Skip to content

feat: warm caches during app startup #3500

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 3 commits into from
Jul 31, 2025

Conversation

bhearsum
Copy link
Contributor

This code runs before the public app begins accepting requests, which should mean that we don't need to hit the database very much after beginning to serve requests. Doing this at start-up also means we fetch the releases sequentially, which should (slightly) spread the load out more.

I verified locally that the app is incapable of responding to requests until public.py finishes executing by adding a time.sleep to the end of it. While the sleep was running requests to the app hung. This means that /__heartbeat__ requests won't complete successfully until caches have been warmed up.

Hopefully this will help with database load during scaling events. See: https://mozilla-hub.atlassian.net/browse/SVCSE-3425

@bhearsum bhearsum force-pushed the push-zwkqnnxyxxuk branch 4 times, most recently from 634140a to 737419e Compare July 28, 2025 20:38
@bhearsum bhearsum marked this pull request as ready for review July 28, 2025 21:11
@bhearsum bhearsum requested a review from a team as a code owner July 28, 2025 21:11
@bhearsum bhearsum force-pushed the push-zwkqnnxyxxuk branch 3 times, most recently from 2509818 to eb295c2 Compare July 29, 2025 20:40
@bhearsum bhearsum requested a review from ahal July 29, 2025 21:12
bhearsum added 3 commits July 30, 2025 13:08
This will be useful when warming caches.
This code runs before the public app begins accepting requests, which should mean that we don't need to hit the database very much after beginning to serve requests. Doing this at start-up also means we fetch the releases sequentially, which should (slightly) spread the load out more.

I verified locally that the app is incapable of responding to requests until `public.py` finishes executing by adding a `time.sleep` to the end of it. While the sleep was running requests to the app hung. This means that `/__heartbeat__` requests won't complete successfully until caches have been warmed up.

Hopefully this will help with database load during scaling events. See: https://mozilla-hub.atlassian.net/browse/SVCSE-3425
@bhearsum bhearsum force-pushed the push-zwkqnnxyxxuk branch from eb295c2 to a6e8a05 Compare July 30, 2025 17:11
@bhearsum bhearsum merged commit 1021363 into mozilla-releng:main Jul 31, 2025
13 checks passed
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