zerohedge
zerohedge

Reputation: 3765

Why does Celery discourage worker & beat together?

From the celery help function:

> celery worker -h

...

Embedded Beat Options:
  -B, --beat            Also run the celery beat periodic task scheduler. Please note that there must only be
                        one instance of this service. .. note:: -B is meant to be used for development
                        purposes. For production environment, you need to start celery beat separately.

This also appears in the docs.

You can also embed beat inside the worker by enabling the workers -B option, this is convenient if you’ll never run more than one worker node, but it’s not commonly used and for that reason isn’t recommended for production use:

celery -A proj worker -B

But it's not actually explained why it's "bad" to use this in production. Would love some insight.

Upvotes: 8

Views: 4160

Answers (1)

gushitong
gushitong

Reputation: 2036

The --beat option will start a beat scheduler along with the worker.

But you only need one beat scheduler。

In the production environment, you usually have more than one worker running. Using --beat option will be a disaster.

For example: you have a event scheduled at 12:am each day.

If you started two beat process, the event will run twice at 12:am each day.

If you’ll never run more than one worker node, --beat option if just fine.

Upvotes: 12

Related Questions