Skip to content

Commit

Permalink
make workers more resillient
Browse files Browse the repository at this point in the history
prefetch and concurrency were pinning workers to
jobs that weren't going to terminate. this should
alleviate some worker pool exhaustion by cancelling
deadlocked tasks and allowing workers to immediately pick up
tasks from queue if they're available.

Signed-off-by: James Kunstle <[email protected]>
  • Loading branch information
JamesKunstle committed Jan 26, 2024
1 parent d6c7bfb commit 3f8a41e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
3 changes: 2 additions & 1 deletion 8Knot/_celery.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@
)

celery_app.conf.update(
task_time_limit=84600,
task_time_limit=2700, # 45 minutes
task_acks_late=True,
task_track_started=True,
result_extended=True,
worker_prefetch_multiplier=1,
)

celery_manager = CeleryManager(celery_app=celery_app)
3 changes: 2 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ services:
build:
context: .
dockerfile: ./docker/Dockerfile
command: ["celery", "-A", "app:celery_app", "worker", "--loglevel=INFO"]
command: ["celery", "-A", "app:celery_app", "worker", "--loglevel=INFO", "--concurrency=1"]
depends_on:
- redis-cache
- redis-users
Expand All @@ -77,6 +77,7 @@ services:
"--loglevel=INFO",
"-Q",
"data",
"--concurrency=1"
]
depends_on:
- redis-cache
Expand Down
4 changes: 2 additions & 2 deletions openshift/base/8k-autoscale.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ spec:
kind: Deployment
name: eightknot-worker-callback
minReplicas: 1
maxReplicas: 20
maxReplicas: 30 # each is its own process
metrics:
- type: Resource
resource:
Expand All @@ -59,7 +59,7 @@ spec:
kind: Deployment
name: eightknot-worker-query
minReplicas: 1
maxReplicas: 8
maxReplicas: 20
metrics:
- type: Resource
resource:
Expand Down
4 changes: 2 additions & 2 deletions openshift/overlays/prod/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ patches:
patch: |-
- op: add
path: /spec/replicas
value: 3
value: 15
- target:
kind: Deployment
name: eightknot-worker-query
patch: |-
- op: add
path: /spec/replicas
value: 2
value: 10
- target:
kind: HorizontalPodAutoscaler
patch: |-
Expand Down

0 comments on commit 3f8a41e

Please sign in to comment.