Can I increase celery worker replicas without redeployment?Best way of scaling without redeployment?
mikexie360
PROOP

a year ago

Project id:1c617954-59dd-4549-ab16-cd01fbc3310a

Best way to scale celery worker?

  1. If I scale by increasing replicas, I have to do a redeployment, which I don't want.

  2. If I scale by increasing vCPU, I can't use all CPU, since I only have concurrency as 1.

  3. If I put concurrency at 32, it can use all vCPU if I increase vCPU without deployment, but it has high overhead if I don't use all VCPU.

Best way to do scaling with celery worker?

Solved

5 Replies

mikexie360
PROOP

a year ago

Also if a celery worker service does a redeployment.
And the celery worker is doing work, does the work disappear if a redeployment happens?


brody
EMPLOYEE

a year ago

i think the best way here is to simply provision however many replicas and the concurrency levels you would need at your theoretical max job throughput.

likely by default the celery worker would pick back up any unfinished jobs, its a task worker, surely it has built in fault tolerance, but during a new deployment Railway sends sigterm, waits 3 seconds (configurable) and then kills the container, so as long as celery respects the sigterm and stops accepting jobs and then finishes the in flight jobs then you are fine.


mikexie360
PROOP

a year ago

ok I see.

So this is more of a celery problem rather than a railway.app problem.

I do believe celery has some configuration that I need to figure out. Because right now, if I do a redeployment, all celery workers die, and new ones get spawned, and the tasks that were being worked on by the dead celery workers will become invisibile on the broker, unless enough time passes, depending on the configuration, and will become visibile again on redis.

So if I do a redeployment, and if I configure my celery workers correctly, all that should happen is that the work ends up being delayed by a few hours, instead of disappearing.

1323513806969770000


brody
EMPLOYEE

a year ago

i think there would be further problems with the celery config if work is delayed a few hours after a redeploy, but yes you are on the right track


brody
EMPLOYEE

a year ago

!s


Status changed to Solved brody about 1 year ago


Loading...