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

# Scaling and high availability

export const Alert = ({type, title, children}) => {
  const variant = ["info", "success", "warning", "danger", "note"].includes(type) ? type : "note";
  return <div className={`alert alert--${variant}`}>
      <div className="alert-icon" />
      <div className="alert-content">
        {title && <div className="alert-title">{title}</div>}
        <div className="alert-body">{children}</div>
      </div>
    </div>;
};

The agent is designed to vertically and horizontally scale to meet the needs of your Superblocks workloads. See instructions below for the relevant scaling and resource allocation settings depending on your deployment method.

<Alert type="info" title="Recommended minimum resources">
  <ul>
    <li><em>CPU</em>: 1</li>
    <li><em>Memory</em>: 4GiB</li>
    <li><em>Replicas</em>: 1 for initial development & staging instances, 3 for production</li>
  </ul>
</Alert>

## Kubernetes

See the `autoscaling` and `resources` sections of the Helm chart `values.yaml` for the default autoscaling and resource settings. Adjust as needed depending on your workload.

```yaml theme={null}
autoscaling:
  enabled: false
  minReplicas: 1
  maxReplicas: 100
  targetCPUUtilizationPercentage: 40
  targetMemoryUtilizationPercentage: 80
  customMetrics: []
  # - type: External
  #   external:
  #     metricName: nginx.net.request_per_s
  #     metricSelector:
  #       matchLabels:
  #           kube_container_name: nginx
  #     targetAverageValue: 123

# Please adjust these values as needed depending on your workloads. We recommend allocating
# minimally the following to prevent CPU throttling and Out of Memory errors under load.
resources:
  limits:
    memory: 4Gi
  requests:
    cpu: 1
    memory: 4Gi
```

## ECS Fargate

#### Instance Size

To configure the CPU & memory limits allocated to your ECS instances use the following variables in your Terraform file.

```
container_cpu = 1024
container_memory = 4096
```

#### Scaling

AWS will automatically scale your ECS instances based on traffic. To configure the minimum and maximum number of instances the agent can scale to, set the following variables in your Terraform file.

```
container_min_capacity = 1
container_max_capacity = 10
```

## Google Cloud Run

#### Instance Size

To configure the CPU & memory limits for your Cloud Run instances, use the following variables in your Terraform file.

```
container_requests_cpu    = "1"
container_requests_memory = "4Gi"
container_limits_memory   = "4Gi"
```

#### Scaling

Google will automatically scale your Cloud Run instances based on traffic. To configure the minimum and maximum number of instances the agent can scale to, set the following variables in your Terraform file.

```
container_min_capacity    = "1"
container_max_capacity    = "5"
```
