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 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 on the user workloads to ensure that clusters are not under utilized 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  
Analytics Engine Powered by Apache Spark  
Cognos® Analytics  
Cognos Dashboards
Data Privacy  
Data Refinery  
Data Virtualization  
DataStage®
Db2®  
Db2 Big SQL  
Db2 Data Gate  
Db2 Data Management Console  
Db2 Warehouse  
Decision Optimization  
EDB Postgres  
Execution Engine for Apache Hadoop  
Guardium® External S-TAP®  
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 Speech services  
Watson Studio  
Watson Studio Runtimes  

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\"}'

    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:

      oc patch OpenPagesInstance <instance_name> \
       --namespace ${PROJECT_CPD_INSTANCE} \
       --patch '{"spec":{"autoScaleConfig":true}}' \
       --type=merge
    • Run the following command to disable horizontal autoscaling for an OpenPages service instance:

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

    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\"}'

    Watson Assistant

    4.5.3 Starting with IBM Cloud Pak for Data 4.5.3, you can enable and disable horizontal autoscaling for Watson Assistant. By default, horizontal autoscaling is enabled when you install the service.

    • Run the following command to enable horizontal autoscaling for the service.

      The 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 patch wa wa \
       --namespace ${PROJECT_CPD_INSTANCE} \
       --patch='[{"op": "replace", "path": "/spec/autoScaleConfig", "value":true}]' \
       --type='json'
    • Run the following command to disable horizontal autoscaling for the service.

      The 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 patch wa wa \
       --namespace ${PROJECT_CPD_INSTANCE} \
       --patch='[{"op": "replace", "path": "/spec/autoScaleConfig", "value":false}]' \
       --type='json'