Select a documentation version: <button class="button button-with-icon cloud-select-dropdown__button button-primary" aria-haspopup="true">18.3.0</button>

- [Current (18.4.0)](https://docs.cloud.google.com/alloydb/omni/redhat-orchestrator/current/docs/scale-cpu-memory-resources.md.txt)
- [18.4.0](https://docs.cloud.google.com/alloydb/omni/redhat-orchestrator/18.4.0/docs/scale-cpu-memory-resources.md.txt)
- [18.3.0](https://docs.cloud.google.com/alloydb/omni/redhat-orchestrator/18.3.0/docs/scale-cpu-memory-resources.md.txt)

<br />

This page describes how to scale CPU and memory resources using the AlloyDB Omni RPM orchestrator.

<br />

## Before you begin

Before you scale CPU and memory resources, make sure that you have:

1. [Installed](https://docs.cloud.google.com/alloydb/omni/redhat-orchestrator/18.3.0/docs/install-orchestrator.md.txt) the AlloyDB Omni orchestrator.
2. Provisioned and [created](https://docs.cloud.google.com/alloydb/omni/redhat-orchestrator/18.3.0/docs/create-cluster.md.txt) your AlloyDB Omni cluster.

## Scale CPU and memory resources

To scale the CPU and memory resources for your AlloyDB Omni
database cluster, update your `DBCluster` resource specification:

1. Open your `DBCluster` database cluster manifest file.

2. Under the `primarySpec` section, modify the `cpu` and `memory` values in the `resources` block:

   ```yaml
   DBCluster:
     metadata:
       name: CLUSTER_NAME
     spec:
       # ... existing cluster configuration ...
       primarySpec:
         # ... existing primary configuration ...
         resources:
           cpu: CPU_COUNT
           memory: MEMORY_MIN
           limits:
             memory: MEMORY_MAX
           disks:
           # ...
   ```

   Replace the following:
   - `CLUSTER_NAME`: the name of your database cluster.
   - `CPU_COUNT`: the number of CPUs available to the database instance.
   - `MEMORY_MIN`: the minimum amount of memory allocated to the database instance, for example `16Gi`.
   - `MEMORY_MAX`: the maximum amount of memory allocated to the database instance.
3. Apply the updated `DBCluster` database cluster manifest using your preferred
   orchestrator interface. The AlloyDB Omni orchestrator
   automatically restarts the database to apply the resource changes.

   ### Ansible

   If you're managing your AlloyDB Omni RPM orchestrator
   infrastructure directly using Ansible, it triggers updates by running
   the appropriate playbook and passing the selected `update_action` as an
   extra variable.

   Sample file for `update.yml`:

   ```yaml
   ---
   - hosts: localhost
     vars:
       update_action: "update_resource_spec"
       ansible_user: your_ssh_user
       ansible_ssh_private_key_file: ~/path/to/private-key
     roles:
       - role: google.alloydbomni_orchestrator.update
   ```

   Run the Ansible command:

   ```bash
   ansible-playbook -i "DEPLOYMENT_SPECIFICATION" update.yml -e resource_spec="DBCLUSTER_SPECIFICATION"
   ```

   Replace the following variables:
   - `DEPLOYMENT_SPECIFICATION`: path to the deployment specification you created in [Install AlloyDB Omni components](https://docs.cloud.google.com/alloydb/omni/redhat-orchestrator/18.3.0/docs/install-components.md.txt).
   - `DBCLUSTER_SPECIFICATION`: path to your cluster specification.

   ### `alloydbctl`

   ```bash
   alloydbctl apply -d DEPLOYMENT_SPECIFICATION -r DBCLUSTER_SPECIFICATION
   ```

   Replace the following variables:
   - `DEPLOYMENT_SPECIFICATION`: path to the deployment specification you created in [Install AlloyDB Omni components](https://docs.cloud.google.com/alloydb/omni/redhat-orchestrator/18.3.0/docs/install-components.md.txt).
   - `DBCLUSTER_SPECIFICATION`: path to your cluster specification.