Scaling via DOKKU_SCALE vs gunicorn --worker

I’m deploying with Dash enterprise and am a little confused about the configuration. In my Procfile I specify both a web and worker process:

web: gunicorn app:server
worker: celery -A app.celery_app worker

The worker process is for some long callbacks.

In the docs it says " You will need DOKKU_SCALE if your Procfile includes processes other than web". This seems simple enough:

DOKKU_SCALE

web=2
worker=4

However the documentation then says " we recommend scaling your Dash app by enabling the gunicorn –worker and –preload flags in your Procfile before modifying DOKKU_SCALE".

Does this statement mean I should use --worker 2 in my Procfile in addition to specifying web=2 in my DOKKU_SCALE file, or should I omit web=2 altogether so that my DOKKU_SCALE file only has a single line for the worker process: worker=4?

Hi @james_cultivarium !

That’s actually a really good question and the misunderstanding is a common one.

There are two ways to scale your app:

  1. scaling gunicorn workers or celery concurrency in Procfile
  2. scaling the number of containers of each line defined in the procfile using DOKKU_SCALE

The numbers in the first line of DOKKU_SCALE refer to the number of Docker containers that are going to run the app. Each one of those containers would run then the corresponding line in the Procfile with the corresponding workers.

We recommend scaling first the workers n the Procfile because it is less complex and takes less resources computationally than creating new Docker containers with DOKKU_SCALE.

I hope this helps!

5 Likes