Scale CPU and memory resources

Select a documentation version:

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

Before you begin

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

  1. Installed the AlloyDB Omni orchestrator.
  2. Provisioned and created 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:

    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:

    ---
    - 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:

    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.
    • DBCLUSTER_SPECIFICATION: path to your cluster specification.

    alloydbctl

    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.
    • DBCLUSTER_SPECIFICATION: path to your cluster specification.