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

EXPERIMENTAL: change celery pool support from prefork to threads #1437

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

terrazoon
Copy link
Contributor

@terrazoon terrazoon commented Nov 25, 2024

Description

The article referenced in issue #1432 says that prefork is the default pool support for Celery because it is robust and pythonic and good for CPU bound apps. The problem becomes when you have an IO bound app, and you find out that prefork is a CPU hog. Prefork holds onto CPU utilization even when nothing is going on. Our last load test showed that we seemed to exceed our allocated CPU utilization by a wide margin and this seemed to destabilize the app towards the end of the test.

By switching to threads, we will have more concurrency, less CPU utilization, and less memory utilization. ASSUMING IT IS STABLE. The caveats are that everything has to be thread safe. We are currently using multiprocessing.Manager (thread safe) and ThreadPoolExecutor (thread safe) so we might be good here.

Testing locally this of course works perfectly fine. We should do a load test on production after hours and see if this would be a viable approach.

Security Considerations

@terrazoon terrazoon changed the title change celery pool support from prefork to threads EXPERIMENTAL: change celery pool support from prefork to threads Nov 25, 2024
@terrazoon terrazoon self-assigned this Nov 25, 2024
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.

1 participant