--- title: "Worker Processes" description: "Procfile processes besides your web - sized from app.json, scaled on their own, and billed like your app." --- A `Procfile` (or app.json's `formation`) can declare more than a `web` process - a `sidekiq`, a `clock`, a queue worker. Miget runs each of those as its own Deployment, under the name you gave it in the `Procfile`, and the dashboard and API call them **workers**. ``` web: bundle exec puma -C config/puma.rb worker: bundle exec sidekiq clock: bundle exec clock ``` This is deployed from code, not created through a form - there is no endpoint that adds, removes, or resizes a worker. What exists comes from what your `Procfile` declares and what has actually run; dropping a process from the `Procfile` does not delete its worker while it is still running, and adding one back picks up the existing row. ## Sizing from app.json A worker's replica count and size both come from `app.json`'s `formation` on every deploy, held to the [workspace's limits](/pricing/workspace-limits): ```json app.json { "formation": { "web": { "quantity": 1, "size": "standard-1x" }, "worker": { "quantity": 2, "size": "hobby-1c-1g" } } } ``` - **`quantity`** sets the worker's replica count on every deploy. - **`size`** sets the worker's CPU and RAM. It takes either one of Miget's own size codes (the same list as [Usage Billing](/pricing/usage-billing#choosing-a-size), e.g. `hobby-1c-1g`) or a Heroku dyno size, mapped like this: | Heroku dyno size | Miget size | |---|---| | `eco`, `basic`, `standard-1x` (and the older `free`, `hobby`, `1x`) | `hobby-1c-512m` | | `standard-2x` (`2x`) | `hobby-1c-1g` | | `private-s`, `shield-s` | `pro-1c-2g` | | `performance-m`, `private-m`, `shield-m`, `px` | `pro-2c-4g` | | `*-l` | `pro-8c-16g` | | `*-l-ram` | `pro-16c-32g` | | `*-xl` | `pro-32c-64g` | | Fir's `dyno-Nc-Mgb` | the smallest Pro size with at least N CPU and M GB | A worker with no `size` runs at the application's own size. A size with no match in the application's CPU class - a Pro code or a dedicated dyno on a Hobby app, a Hobby code or a shared dyno on a Pro app - falls back to the application's size too, capped at one replica, and the deployment shows a warning explaining why. `web`'s own `size` in `formation` works the same way, and - like everything else `app.json` declares - wins over whatever the dashboard or API last set, on every deploy. See [app.json](/overview/app-json#supported-fields). ## Scaling a worker Scale one worker on its own, independently of the web process and every other worker, from the application's **Processes** section in the dashboard, or with: ```bash curl -X PUT "https://app.miget.com/api/v1/apps/{uuid}/workers/{name}" \ -H "Authorization: Bearer $MIGET_API_TOKEN" \ -H "Content-Type: application/json" \ -d '{"replicas": 3}' ``` It takes the same fields the application's own scaling does - `replicas`, or `auto_scaling_enabled` with `auto_min_replicas` / `auto_max_replicas` and the CPU/memory thresholds - except there is no monthly budget for a worker, and no scaling beyond a resource's plan. **It lasts until the next deploy.** As with anything `app.json` declares, the next deploy sets this worker's replicas back to whatever `formation`'s `quantity` says; a worker that `formation` does not name keeps the count you scaled it to. To keep a count permanently, put it in `app.json`. Not available on the free plan. ## Billing - **On a resource**, a worker takes RAM after the web process, add-ons, and cron jobs have all taken theirs - the same resource, split further. If a resource is overfull because of its workers, its page and the application's Resource Allocation section say so, and name which workers and by how much. - **On [Usage Billing](/pricing/usage-billing)**, a worker is billed exactly like the application itself: at its own size, for the replicas it runs, for the seconds it runs them. ## Free compute and held workers Free compute - one free application per account on Usage Billing - covers the **web process only**. If that application's `Procfile` declares other processes, they are held at zero replicas with an `awaiting_checkout` [issue](/monitoring/issues) open on each, until the workspace starts paying for Usage Billing. Start it from the application page ("Start Usage Billing") or with `POST /api/v1/workspace/pay_per_use/start` - this only starts the $5 monthly minimum, without creating anything else. Once it is held, every held worker starts at one replica; the next deploy brings `app.json`'s own replica count back. ## Logs and troubleshooting Each worker's logs are on the application's **Logs** page, listed next to the web process with its own pods. If a worker keeps crashing or runs out of memory, Miget stops that worker alone - the web process and every other worker keep running - and opens an issue and sends a notification naming it. See [Issues](/monitoring/issues) and [Webhooks](/monitoring/webhooks). ## Next steps Every field app.json controls on a deploy. Sizes and rates for a worker running without a resource. Why something stopped, and where to see the history. Running an API, a worker, cron jobs, and a database on one plan.