Automatically scaling resources for services

Some IBM Cloud Pak® for Data services support autoscaling by using the Red Hat® OpenShift® Horizontal Pod Autoscaler (HPA). The HPA changes the resource allocation of services by increasing or decreasing the number of pods in response to CPU or memory consumption.

Permissions that you need for this task
You must be either:
  • A cluster administrator
  • An administrator of the project where the software is installed, for example cpd-instance
When you need to complete this task
When you want to dynamically scale resources for services based on usage.

Instead of using the manual, fixed approach to scaling resources for services, you can enable autoscaling to dynamically scale up and down based. The scaling is based on the user workloads to ensure that clusters are not underutilized while available resources cannot be used by workloads that require more resources.

The following table shows the services that support autoscaling. You can see detailed instructions or each service in the procedure for automatically scaling resources for services.
Service name Supports the autoScaleConfig setting automatically scale resources for the service
Cloud Pak for Data control plane
Common core services
IBM Cloud Pak foundational services  
AI Factsheets
Analytics Engine powered by Apache Spark  
Cognos® Analytics
Cognos Dashboards
Data Privacy
Data Refinery
Data Replication  
DataStage®
Db2®  
Db2 Big SQL  
Db2 Data Gate  
Db2 Data Management Console
Db2 Warehouse  
Decision Optimization
EDB Postgres  
Execution Engine for Apache Hadoop  
IBM® Match 360 with Watson™
Informix®  
MANTA Automated Data Lineage  
OpenPages®
Planning Analytics
Product Master
Scheduling service  
SPSS® Modeler
Voice Gateway  
Watson Assistant
Watson Discovery  
Watson Knowledge Catalog  
Watson Knowledge Studio  
Watson Machine Learning
Watson Machine Learning Accelerator
Watson OpenScale
Watson Pipelines
Watson Query  
Watson Speech services  
Watson Studio
Watson Studio Runtimes  
watsonx.data

Before you begin

Best practice: You can run the commands in this task exactly as written if you set up environment variables. For instructions, see Setting up installation environment variables.

Ensure that you source the environment variables before you run the commands in this task.

Procedure

  1. Run the cpd-cli manage login-to-ocp command to log in to the cluster as a user with sufficient permissions to complete this task. For example:
    cpd-cli manage login-to-ocp \
    --username=${OCP_USERNAME} \
    --password=${OCP_PASSWORD} \
    --server=${OCP_URL}
  2. Enable or disable autoscaling for services as needed:

    Cloud Pak for Data control plane
    • Run the following command to enable horizontal autoscaling for the service:

      oc patch ZenService lite-cr \
      --namespace ${PROJECT_CPD_INST_OPERANDS} \
      --type=merge \
      --patch '{"spec": {"autoScaleConfig": true}}'
    • Run the following command to disable horizontal autoscaling for the service:

      oc patch ZenService lite-cr \
      --namespace ${PROJECT_CPD_INST_OPERANDS} \
      --type=merge \
      --patch '{"spec": {"autoScaleConfig": false}}'

    Common core services
    • Run the following command to enable horizontal autoscaling for the service:

      oc patch ccs ccs-cr \
      --namespace ${PROJECT_CPD_INST_OPERANDS} \
      --patch '{"spec":{"autoScaleConfig":true}}' \
      --type=merge
    • Run the following command to disable horizontal autoscaling for the service:

      oc patch ccs ccs-cr \
      --namespace ${PROJECT_CPD_INST_OPERANDS} \
      --patch '{"spec":{"autoScaleConfig":false}}' \
      --type=merge

    AI Factsheets
    • Run the following command to enable horizontal autoscaling for the service:

      cpd-cli manage update-cr \
      --component=factsheet \
      --cpd_instance_ns=${PROJECT_CPD_INST_OPERANDS} \
      --patch='{\"autoScaleConfig\":\"true\"}'
    • Run the following command to disable horizontal autoscaling for the service:

      cpd-cli manage update-cr \
      --component=factsheet \
      --cpd_instance_ns=${PROJECT_CPD_INST_OPERANDS} \
      --patch='{\"autoScaleConfig\":\"false\"}'

    Cognos Analytics
    The autoScaleConfig setting is applied to the dynamic CR. To find the name of the CR, run the following command:
    cr_name = $(oc -n ${tethered_namespace} get caserviceinstance --no-headers -o custom-columns=NAME:.metadata.name)
    • Run the following command to enable horizontal autoscaling for the service:

      oc patch caserviceinstance ${cr_name} 
      --type merge 
       -p "{\"spec\":{\"autoScaleConfig\":\"true\"}}" 
       -n ${tethered_namespace}
    • Run the following command to disable horizontal autoscaling for the service:

      oc patch caserviceinstance ${cr_name} 
      --type merge 
       -p "{\"spec\":{\"autoScaleConfig\":\"false\"}}" 
       -n ${tethered_namespace}

    Cognos Dashboards
    • Run the following command to enable horizontal autoscaling for the service:

      oc patch DashboardService dashboardservice-cr \
      --namespace ${PROJECT_CPD_INST_OPERANDS} \
      --patch '{"spec":{"autoScaleConfig":true}}' \
      --type=merge
    • Run the following command to disable horizontal autoscaling for the service:

      oc patch  DashboardService dashboardservice-cr  \
      --namespace ${PROJECT_CPD_INST_OPERANDS} \
      --patch '{"spec":{"autoScaleConfig":false}}' \
      --type=merge

    Data Privacy
    • Run the following command to enable horizontal autoscaling for the service:

      cpd-cli manage update-cr \
      --component=dp \
      --cpd_instance_ns=${PROJECT_CPD_INST_OPERANDS} \
      --patch='{\"autoScaleConfig\":\"true\"}'
    • Run the following command to disable horizontal autoscaling for the service:

      cpd-cli manage update-cr \
      --component=dp \
      --cpd_instance_ns=${PROJECT_CPD_INST_OPERANDS} \
      --patch='{\"autoScaleConfig\":\"false\"}'

    Data Refinery
    • Run the following command to enable horizontal autoscaling for the service:

      oc patch  DataRefinery datarefinery-sample \
      --namespace ${PROJECT_CPD_INST_OPERANDS} \
      --patch '{"spec":{"autoScaleConfig":true}}' \
      --type=merge
    • Run the following command to disable horizontal autoscaling for the service:

      oc patch  DataRefinery datarefinery-sample  \
      --namespace ${PROJECT_CPD_INST_OPERANDS} \
      --patch '{"spec":{"autoScaleConfig":false}}' \
      --type=merge

    DataStage
    • Run the following command to enable horizontal autoscaling for the service:

      cpd-cli manage update-cr \
      --component=datastage_ent \
      --cpd_instance_ns=${PROJECT_CPD_INST_OPERANDS} \
      --patch='{\"autoScaleConfig\":\"true\"}'
    • Run the following command to disable horizontal autoscaling for the service:

      cpd-cli manage update-cr \
      --component=datastage_ent \
      --cpd_instance_ns=${PROJECT_CPD_INST_OPERANDS} \
      --patch='{\"autoScaleConfig\":\"false\"}'

    Db2 Data Management Console
    • Run the following command to enable horizontal autoscaling for a Db2 Data Management Console service instance:

      oc patch Dmcaddon <instance_name> \
       --namespace ${PROJECT_CPD_INST_OPERANDS} \
       --patch '{"spec":{"autoScaleConfig":true}}' \
       --type=merge
    • Run the following command to disable horizontal autoscaling for a Db2 Data Management Console service instance:

      oc patch Dmcaddon <instance_name> \
       --namespace ${PROJECT_CPD_INST_OPERANDS} \
       --patch '{"spec":{"autoScaleConfig":false}}' \
       --type=merge

    Decision Optimization
    • Run the following command to enable horizontal autoscaling for the service:

      oc patch DODS dods-cr \
      --namespace ${PROJECT_CPD_INST_OPERANDS} \
      --patch '{"spec":{"autoScaleConfig":true}}' \
      --type=merge

      This command uses the default custom resource name: dods-cr. If you use a different name, edit the command to specify the appropriate value for your environment.

    • Run the following command to disable horizontal autoscaling for the service:

      oc patch DODS dods-cr  \
      --namespace ${PROJECT_CPD_INST_OPERANDS} \
      --patch '{"spec":{"autoScaleConfig":false}}' \
      --type=merge

      This command uses the default custom resource name: dods-cr. If you use a different name, edit the command to specify the appropriate value for your environment.


    IBM Match 360 with Watson
    • Run the following command to enable horizontal autoscaling for the service:

      oc patch mdm mdm-cr \
      --namespace ${PROJECT_CPD_INST_OPERANDS} \
      --patch '{"spec":{"autoScaleConfig":true}}' \
      --type=merge
    • Run the following command to disable horizontal autoscaling for the service:

      oc patch mdm mdm-cr \
      --namespace ${PROJECT_CPD_INST_OPERANDS} \
      --patch '{"spec":{"autoScaleConfig":false}}' \
      --type=merge

    OpenPages
    • Run the following command to enable horizontal autoscaling for an OpenPages service instance:

      cpd-cli manage update-cr \
      --component=openpages_instance \
      --cpd_instance_ns=${PROJECT_CPD_INST_OPERANDS} \
      --patch='{\"autoScaleConfig\":true}' \
      --extra-vars=cr_name=<instance_name>
    • Run the following command to disable horizontal autoscaling for an OpenPages service instance:

      cpd-cli manage update-cr \
      --component=openpages_instance \
      --cpd_instance_ns=${PROJECT_CPD_INST_OPERANDS} \
      --patch='{\"autoScaleConfig\":false}' \
      --extra-vars=cr_name=<instance_name>
    Note: If OpenPages is installed in a tethered project, add the following parameter to these commands.
    --tethered_instance_ns=${TETHERED_NAMESPACE}

    Planning Analytics
    • Run the following command to enable horizontal autoscaling for a Planning Analytics service instance:

      oc patch PAServiceInstance <instance_name> \
       --namespace ${PROJECT_CPD_INST_OPERANDS} \
       --patch '{"spec":{"autoScaleConfig":true}}' \
       --type=merge
    • Run the following command to disable horizontal autoscaling for a Planning Analytics service instance:

      oc patch PAServiceInstance <instance_name> \
       --namespace ${PROJECT_CPD_INST_OPERANDS} \
       --patch '{"spec":{"autoScaleConfig":false}}' \
       --type=merge

    Product Master
    • Run the following command to enable horizontal autoscaling for the service:

      cpd-cli manage update-cr \
      --component=productmaster_instance \
      --cpd_instance_ns=${PROJECT_CPD_INST_OPERANDS} \
      --patch='{\"autoScaleConfig\":true}'
    • Run the following command to disable horizontal autoscaling for the service:

      cpd-cli manage update-cr \
      --component=productmaster_instance \
      --cpd_instance_ns=${PROJECT_CPD_INST_OPERANDS} \
      --patch='{\"autoScaleConfig\":false}'

    SPSS Modeler
    • Run the following command to enable horizontal autoscaling for the service:

      oc patch spss spss-sample \
      --namespace cpd-instance \
      --patch '{"spec":{"autoScaleConfig":true}}' \
      --type=merge
    • Run the following command to disable horizontal autoscaling for the service:

      oc patch spss spss-sample \
      --namespace cpd-instance \
      --patch '{"spec":{"autoScaleConfig":false}}' \
      --type=merge

    Watson Assistant
    • Run one of the following commands to enable horizontal autoscaling for the service:
      • This command uses the default custom resource name: wa. If you use a different name, edit the command to specify the appropriate value for your environment.

        oc project ${PROJECT_CPD_INST_OPERANDS}
        export INSTANCE=`oc get wa -n ${PROJECT_CPD_INST_OPERANDS} |grep -v NAME| awk '{print $1}'`
        oc patch wa ${INSTANCE} \
        --namespace ${PROJECT_CPD_INST_OPERANDS} \
        --patch='[{"op": "replace", "path": "/spec/autoScaleConfig", "value":true}]' \
        --type='json'
      • oc project ${PROJECT_CPD_INST_OPERANDS}
        export INSTANCE=`oc get wa -n ${PROJECT_CPD_INST_OPERANDS} |grep -v NAME| awk '{print $1}'`
        cpd-cli manage update-cr \
        --component=watson_assistant \
        --cpd_instance_ns=${PROJECT_CPD_INST_OPERANDS} \
        --patch='{"autoScaleConfig\":true}'
    • Run one of the following commands to disable horizontal autoscaling for the service.

      This command uses the default custom resource name: wa. If you use a different name, edit the command to specify the appropriate value for your environment.

      • oc project ${PROJECT_CPD_INST_OPERANDS}
        export INSTANCE=`oc get wa -n ${PROJECT_CPD_INST_OPERANDS} |grep -v NAME| awk '{print $1}'`
        oc patch wa ${INSTANCE} \
        --namespace ${PROJECT_CPD_INST_OPERANDS} \
        --patch='[{"op": "replace", "path": "/spec/autoScaleConfig", "value":false}]' \
        --type='json'
      • oc project ${PROJECT_CPD_INST_OPERANDS}
        export INSTANCE=`oc get wa -n ${PROJECT_CPD_INST_OPERANDS} |grep -v NAME| awk '{print $1}'`
        cpd-cli manage update-cr \
        --component=watson_assistant \
        --cpd_instance_ns=${PROJECT_CPD_INST_OPERANDS} \
        --patch='{\"autoScaleConfig\":false}'

    Watson Machine Learning
    • Run the following command to enable horizontal autoscaling for the service:

      cpd-cli manage update-cr \
      --component=wml \
      --cpd_instance_ns=${PROJECT_CPD_INST_OPERANDS} \
      --patch='{\"autoScaleConfig\":\"true\"}'
    • Run the following command to disable horizontal autoscaling for the service:

      cpd-cli manage update-cr \
      --component=wml \
      --cpd_instance_ns=${PROJECT_CPD_INST_OPERANDS} \
      --patch='{\"autoScaleConfig\":\"false\"}'

    Watson Machine Learning Accelerator
    • Run one of the following commands to enable horizontal autoscaling for the service:

      This command uses the default custom resource name: wmla. If you use a different name, edit the command to specify the appropriate value for your environment.

      • oc project ${PROJECT_CPD_INST_OPERANDS}
        export INSTANCE=`oc get wmla -n ${PROJECT_CPD_INST_OPERANDS} |grep -v NAME| awk '{print $1}'`
        oc patch wmla ${INSTANCE} \
        --namespace ${PROJECT_CPD_INST_OPERANDS} \
        --patch='[{"op": "replace", "path": "/spec/autoScaleConfig", "value":true}]' \
        --type='json'
      • oc project ${PROJECT_CPD_INST_OPERANDS} 
        export INSTANCE=`oc get wmla -n ${PROJECT_CPD_INST_OPERANDS} |grep -v NAME| awk '{print $1}'`
        cpd-cli manage update-cr \
        --component=wml_accelerator \
        --cpd_instance_ns=${PROJECT_CPD_INST_OPERANDS} \
        --patch='{\"autoScaleConfig\":true}'
    • Run one of the following commands to disable horizontal autoscaling for the service.

      This command uses the default custom resource name: wmla. If you use a different name, edit the command to specify the appropriate value for your environment.

      • oc project ${PROJECT_CPD_INST_OPERANDS}
        export INSTANCE=`oc get wmla -n ${PROJECT_CPD_INST_OPERANDS} |grep -v NAME| awk '{print $1}'`
        oc patch wmla ${INSTANCE} \
        --namespace ${PROJECT_CPD_INST_OPERANDS} \
        --patch='[{"op": "replace", "path": "/spec/autoScaleConfig", "value":false}]' \
        --type='json'
      • oc project ${PROJECT_CPD_INST_OPERANDS} 
        export INSTANCE=`oc get wmla -n ${PROJECT_CPD_INST_OPERANDS} |grep -v NAME| awk '{print $1}'`
        cpd-cli manage update-cr \
        --component=wml_accelerator \
        --cpd_instance_ns=${PROJECT_CPD_INST_OPERANDS} \
        --patch='{\"autoScaleConfig\":false}'
    Run the following command to verify whether horizontal autoscaling is enabled for the service:
    oc get hpa -n ${PROJECT_CPD_INST_OPERANDS}

    Watson OpenScale
    • Run the following command to enable horizontal autoscaling for the service:

      cpd-cli manage update-cr \
      --component=openscale \
      --cpd_instance_ns=${PROJECT_CPD_INST_OPERANDS} \
      --patch='{\"autoScaleConfig\":true}'
    • Run the following command to disable horizontal autoscaling for the service:

      cpd-cli manage update-cr \
      --component=openscale \
      --cpd_instance_ns=${PROJECT_CPD_INST_OPERANDS} \
      --patch='{\"autoScaleConfig\":false}'

    Watson Pipelines
    • Run the following command to enable horizontal autoscaling for the service:

      cpd-cli manage update-cr \
      --component=ws_pipelines \
      --cpd_instance_ns=${PROJECT_CPD_INST_OPERANDS} \
      --patch='{\"autoScaleConfig\":\"true\"}'
    • Run the following command to disable horizontal autoscaling for the service:

      cpd-cli manage update-cr \
      --component=ws_pipelines \
      --cpd_instance_ns=${PROJECT_CPD_INST_OPERANDS} \
      --patch='{\"autoScaleConfig\":\"false\"}'

    Watson Studio
    • Run the following command to enable horizontal autoscaling for the service:

      cpd-cli manage update-cr \
      --component=ws \
      --cpd_instance_ns=${PROJECT_CPD_INST_OPERANDS} \
      --patch='{\"autoScaleConfig\":\"true\"}'
    • Run the following command to disable horizontal autoscaling for the service:

      cpd-cli manage update-cr \
      --component=ws \
      --cpd_instance_ns=${PROJECT_CPD_INST_OPERANDS} \
      --patch='{\"autoScaleConfig\":\"false\"}'

    watsonx.data
      1. Run the following command to enable horizontal autoscaling in the addon components UI, API, and Nodeclient:

        oc patch wxdAddon wxdaddon \
        --namespace ${PROJECT_CPD_INST_OPERANDS} \
        --type=merge \
        --patch '{"spec": {"autoScaleConfig": true}}'
      2. Complete the following steps to enable horizontal pod autoscaling of Presto workers:
        1. Run the following command to get the Presto engine name:
          oc get wxdengine
          The following example shows a returned engine name:
          NAME                  AGE
          lakehouse-presto-01   75m
        2. Run the following command to enable horizontal pod autoscaling in the pods. Horizontal pod autoscaling only works with multimode deployments because the command scales worker nodes.
          oc patch wxdengine/lakehouse-presto-01 \
            --type=merge \
             -n ${PROJECT_CPD_INST_OPERANDS} \
             -p '{ "spec": { "autoScaleConfig": "true", "lakehouseDeploymentType": "multinode" } }'
      1. Run the following command to disable horizontal autoscaling in the addon components UI, API, and Nodeclient:

        oc patch wxdAddon wxdaddon \
        --namespace ${PROJECT_CPD_INST_OPERANDS} \
        --type=merge \
        --patch '{"spec": {"autoScaleConfig": false}}'
      2. Run the following command to disable horizontal pod autoscaling in the pods:
        oc patch wxdengine/lakehouse-presto-01 \ 
        --type=merge \ 
         -n ${PROJECT_CPD_INST_OPERANDS} \ 
         -p '{ "spec": { "autoScaleConfig": false } }'