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

Adding docker resources limits and reservations for celery #1434

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,11 @@ MIN_CONCURRENCY=10
DJANGO_SUPERUSER_USERNAME=rengine
DJANGO_SUPERUSER_EMAIL=rengine@example.com
DJANGO_SUPERUSER_PASSWORD=Sm7IJG.IfHAFw9snSKv

#
# Docker Resource Limits
#
CELERY_MEM_LIMIT=8gb
CELERY_CPU_LIMIT=2
CELERY_CPU_RESERVE=0.50
CELERY_MEM_RESERVE=1gb
8 changes: 8 additions & 0 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ services:
restart: always
entrypoint: /usr/src/app/celery-entrypoint.sh
# command: watchmedo auto-restart --recursive --pattern="*.py" --directory="/usr/src/app/reNgine/" -- celery -A reNgine.tasks worker --autoscale=10,0 -l INFO
deploy:
resources:
limits:
cpus: ${CELERY_CPU_LIMIT}
memory: ${CELERY_MEM_LIMIT}
reservations:
cpus: ${CELERY_CPU_RESERVE}
memory: ${CELERY_MEM_RESERVE}
volumes:
- ./web:/usr/src/app
- github_repos:/usr/src/github
Expand Down
8 changes: 8 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ services:
restart: always
entrypoint: /usr/src/app/celery-entrypoint.sh
# command: celery -A reNgine worker --autoscale=${MAX_CONCURRENCY},${MIN_CONCURRENCY} -l INFO
deploy:
resources:
limits:
cpus: ${CELERY_CPU_LIMIT}
memory: ${CELERY_MEM_LIMIT}
reservations:
cpus: ${CELERY_CPU_RESERVE}
memory: ${CELERY_MEM_RESERVE}
volumes:
- ./web:/usr/src/app
- github_repos:/usr/src/github
Expand Down
Loading