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®  
MongoDB  
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 N/A

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_INSTANCE} \
      --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_INSTANCE} 
      --type=merge 
      --patch '{"spec": {"autoScaleConfig": false}}'

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

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

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

    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_INSTANCE} \
      --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_INSTANCE} \
      --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_INSTANCE} \
       --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_INSTANCE} \
       --patch '{"spec":{"autoScaleConfig":false}}' \
       --type=merge

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

      oc patch mdm mdm-cr \
      --namespace ${PROJECT_CPD_INSTANCE} \
      --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_INSTANCE} \
      --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_INSTANCE} \
      --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_INSTANCE} \
      --patch='{\"autoScaleConfig\":false}' \
      --extra-vars=cr_name=<instance_name>

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

      oc patch PAServiceInstance <instance_name> \
       --namespace ${PROJECT_CPD_INSTANCE} \
       --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_INSTANCE} \
       --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 \
      --cpd_instance_ns=${PROJECT_CPD_INSTANCE} \
      --patch='{\"autoScaleConfig\":\"true\"}'
    • Run the following command to disable horizontal autoscaling for the service:

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

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

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

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

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