Can I set the number of worker processes in app.json?

I’ve written a Node application that only uses a worker process, no web process. The Deploy to Heroku button is working to deploy the application: I set the WEB_CONCURRENCY environment variable to 0 to disable the web process, but my naïve use of a WORKER_CONCURRENCY variable didn’t set the number of worker processes.

I know I can just require that people run heroku ps:scale worker=1 to create the worker processes, but I’d love if I could avoid that extra configuration step.

You can now do this via the "formations" setting in your app.json, described here:

Although their example only shows web, I have tested that it works with other formation names too (e.g. as defined in your Procfile).

A walk-through of adding a worker process to Heroku applications To demonstrate their use, we will walk through setting up an application that consists of: We add a script, “worker”: “node dist/worker.js”, to the package.json to start While there were a number of configuration steps to setup a worker  Incidentally, you can control the number of threads used per worker process via the machine.config file. I believe the key is maxWorkerThreads. Now, beware, if you use session, Session state is not shared between worker processes. I generally recommend avoiding session anyway but it is something to consider.

I wrote to Heroku support and they said:

I'm afraid there is no way to achieve this at the moment.


This JSON app file allows you to specify the application configuration within We can now start both applications by running this .json file with PM2: e.g. "​pids/"; instances : number of worker processes for your app. Worker processes provide the execution environment for all web sites and applications configured in IIS. Valuable information such as CPU utilization and memory footprint can be obtained from the API to help monitor the health of worker processes and the web server.

Here is how I got an app to deploy with only a worker using the formations in app.json:

  "formation": {
    "web": {
      "quantity": 0,
      "size": "free"
    "worker": {
      "quantity": 1,
      "size": "free"

You can simply adopt the snippets to JS or YAML. Configure Multiple Applications in  Your start command can be set to either a PM2 process file (process.json) or just the startup script of your node app (e.g. bin/www). If your startup script is not set at all, we will try to auto-set in this order: Check if bin/www exists and set that if it does; Check if server.js exists in site root; Check if app.js exists in site root

We do that by creating a new fetch request to /addsubscription, setting the request's method to POST, adding a Content-Type header equal to application/​json to let the server knows we are Let's go through the entire process one more time: 1. We make sure the browser supports service workers, the Notification API, and  In most scenarios, a single worker process is all that is needed. If you do not specifically need this functionality, set the maximum number of worker processes back to 1. If you continue to see failures, you can use Debug Diagnostics to try to determine the root cause of the failure rather than just adding more processes that also fail.

You can declare multiple application easily and specify different options for each of them: only the app named worker-app pm2 start ecosystem.config.js --only worker-app # Stop Inject what is declared in env_production pm2 start process.​json --env You can start as many JSON application declarations as you want. Depending on the number of connections to the Adaptive Server and the approximate number of queries that are run simultaneously, you can use this rule to roughly estimate the value for the number of worker processes that may be needed at any time: [number of worker processes] = [max parallel degree] X [the number of concurrent connections wanting to run queries in parallel] X [1.5] For example, to set the number of worker processes to 40: sp_configure "number of worker processes", 40 Any

If you are running Spark on top of YARN or Mesos cluster managers, you can start a history is provided in JSON format for running applications and for apps from history. by your application, by worker processes, and by the driver and executors. Spark offers the freedom to monitor your application using a different set of  You can access and modify incoming config values by exporting a function that returns an object. This is useful if your project also has an app.json. By default, Expo CLI will read the app.json first and send the normalized results to the app.config.js. This functionality is disabled when the --config is used to specify a custom config.

  • Checkout this answer: It worked for me!