> ## Documentation Index
> Fetch the complete documentation index at: https://astronomer.io/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Scale Airflow resources

Configure CPU, memory, and replica settings for Airflow Deployment components including scheduler, webserver, workers, triggerer, Dag processor, and API server.

Resource values are plain integers: CPU in millicpu and memory in MiB.

## Component resources

### Scheduler

The scheduler orchestrates Dag runs and task scheduling.

```yaml wrap theme={null}
scheduler:
  replicas: 1
  resources:
    requests:
      cpu: 500
      memory: 1920
    limits:
      cpu: 1000
      memory: 3840
```

### Scaling considerations

* Add additional replicas for high availability.
* Increase memory for complex Dag dependencies.
* Set `safeToEvict: false` to prevent cluster autoscaler eviction.

### Webserver

```yaml wrap theme={null}
webserver:
  resources:
    requests:
      cpu: 500
      memory: 1920
    limits:
      cpu: 1000
      memory: 3840
```

### API server (Airflow 3+)

```yaml wrap theme={null}
apiServer:
  replicas: 1
  resources:
    requests:
      cpu: 1000
      memory: 3840
    limits:
      cpu: 2000
      memory: 7680
```

### Dag processor (Airflow 2.3+, required in Airflow 3)

```yaml wrap theme={null}
dagProcessor:
  enabled: true
  replicas: 1
  resources:
    requests:
      cpu: 1000
      memory: 3840
    limits:
      cpu: 2000
      memory: 7680
```

<Note>
  In Airflow 2, the Dag processor defaults to 0 replicas and must be explicitly enabled. In Airflow 3, the APC API automatically sets `dagProcessor.enabled: true` and enforces a minimum of 1 replica regardless of configuration.
</Note>

### Triggerer

```yaml wrap theme={null}
triggerer:
  replicas: 1
  resources:
    requests:
      cpu: 500
      memory: 1920
    limits:
      cpu: 1000
      memory: 3840
```

### Workers (Celery executor)

```yaml wrap theme={null}
workers:
  replicas: 2
  resources:
    requests:
      cpu: 1000
      memory: 3840
    limits:
      cpu: 2000
      memory: 7680
  terminationGracePeriodSeconds: 600
```

## Sizing recommendations

### Small workloads (fewer than 50 Dags)

```yaml wrap theme={null}
scheduler:
  resources:
    requests: { cpu: 500, memory: 1920 }
    limits: { cpu: 1000, memory: 3840 }
workers:
  replicas: 1
  resources:
    requests: { cpu: 1000, memory: 3840 }
```

### Medium workloads (50–200 Dags)

```yaml wrap theme={null}
scheduler:
  resources:
    requests: { cpu: 500, memory: 1920 }
    limits: { cpu: 1000, memory: 3840 }
dagProcessor:
  enabled: true
  resources:
    requests: { cpu: 1000, memory: 3840 }
workers:
  replicas: 3
  resources:
    requests: { cpu: 1000, memory: 3840 }
```

### Large workloads (more than 200 Dags)

```yaml wrap theme={null}
scheduler:
  replicas: 2
  resources:
    requests: { cpu: 1000, memory: 3840 }
    limits: { cpu: 2000, memory: 7680 }
dagProcessor:
  enabled: true
  replicas: 2
  resources:
    requests: { cpu: 1000, memory: 3840 }
workers:
  replicas: 10
```

## Autoscale workers with KEDA

Kubernetes Event-driven Autoscaling (KEDA) scales Celery workers based on task queue depth. Enable KEDA for a Deployment using the `updateDeploymentKedaConfig` mutation:

```graphql wrap theme={null}
mutation {
  updateDeploymentKedaConfig(
    deploymentUuid: "<deployment-uuid>"
    state: true
  ) {
    id
    label
  }
}
```

## Monitor resources

```bash wrap theme={null}
# View current resource usage
kubectl top pods -n <deployment-namespace>

# Check resource limits
kubectl describe pod <pod-name> -n <deployment-namespace>
```
