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

Add default celery configurations #1591

Merged
merged 1 commit into from
Jul 27, 2023

Conversation

moisses89
Copy link
Member

@moisses89 moisses89 commented Jul 27, 2023

Description

Several issues are appearing on rabbitMq connections, ("connection reset by peer", "missing heartbeat"...)
One possible reason could be due the high number of messages that celery are sending to keep the heartbeat, mingle and gossip.
The following links explains a little bit more about it:
https://www.cloudamqp.com/docs/celery.html#commandline-arguments
celery/celery#4980

Also we change some default parameter that can be related:

Issues related

#1566

@moisses89 moisses89 marked this pull request as ready for review July 27, 2023 09:38
@moisses89 moisses89 requested a review from a team as a code owner July 27, 2023 09:38
@@ -213,7 +213,21 @@
# https://docs.celeryproject.org/en/stable/userguide/optimizing.html#broker-connection-pools
# https://docs.celeryq.dev/en/latest/userguide/optimizing.html#broker-connection-pools
CELERY_BROKER_POOL_LIMIT = env(
"CELERY_BROKER_POOL_LIMIT", default=env("CELERYD_CONCURRENCY", default=1000)
"CELERY_BROKER_POOL_LIMIT", default=env("CELERYD_CONCURRENCY", default=0)
Copy link
Member Author

Choose a reason for hiding this comment

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

@Uxio0 I changed this value to 0 to open and close connections every time it is needed, maybe could be better a value less than 1000. I'm not sure about to put this to 0, because connections with rabbitMq were designed to be durable.

default=env("CELERY_BROKER_CONNECTION_MAX_RETRIES", default=0),
)
# https://docs.celeryq.dev/en/stable/userguide/configuration.html#broker-channel-error-retry
CELERY_BROKER_CHANNEL_ERROR_RETRY = env.int(
Copy link
Member

Choose a reason for hiding this comment

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

env.bool

@moisses89 moisses89 force-pushed the configure_celery_recommended_parameters branch 2 times, most recently from 967be8b to 79d3131 Compare July 27, 2023 13:28
config/settings/base.py Outdated Show resolved Hide resolved
@@ -13,4 +13,6 @@ fi
sleep 10

echo "==> $(date +%H:%M:%S) ==> Running Celery beat <=="
exec celery -C -A config.celery_app beat -S django_celery_beat.schedulers:DatabaseScheduler --loglevel $log_level
exec celery -C -A config.celery_app beat \
Copy link
Member

Choose a reason for hiding this comment

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

without-heartbeat and so on are not required for the scheduler?

Copy link
Member Author

Choose a reason for hiding this comment

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

looks like is a flag accepted only for workers.
safe-transaction-service-scheduler-1 | Error: No such option: --without-heartbeat

docker/web/run_dev_web.sh Outdated Show resolved Hide resolved
@moisses89 moisses89 force-pushed the configure_celery_recommended_parameters branch from 79d3131 to d7cac92 Compare July 27, 2023 14:32
@moisses89 moisses89 requested a review from Uxio0 July 27, 2023 14:34
@Uxio0 Uxio0 merged commit dbc8864 into master Jul 27, 2023
5 checks passed
@Uxio0 Uxio0 deleted the configure_celery_recommended_parameters branch July 27, 2023 14:58
@github-actions github-actions bot locked and limited conversation to collaborators Jul 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants