Skip to content

Commit

Permalink
Adding docker resources limits and reservations for celery
Browse files Browse the repository at this point in the history
  • Loading branch information
null-ref-0000 committed Sep 12, 2024
1 parent e9251c4 commit f2e71c4
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
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=[email protected]
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

0 comments on commit f2e71c4

Please sign in to comment.