Scaling up Db2 for Watson Knowledge Catalog
You can run a script to add more memory and CPU to the limited deployment of Db2® service on Cloud Pak for Data to support high-availability or increase processing capacity for the Watson™ Knowledge Catalog service.
Determining if you should scale up Db2 is based on analyzing your monitoring tools (for example grafana graphs) for CPU and memory consumption for the Db2u container. If you observe high CPU throttling or if the container memory is at peak capacity, then you should scale up the instance.
Scale up iis-db2u instance
Complete these steps:
- Specify the CPU and memory limit. In this example, CPU is set to 8 vCPU and memory is set to 15
Gi. Modify the values according to your
needs.
oc patch db2ucluster db2oltp-iis --type=merge --patch '{"spec": { "podConfig": { "db2u": { "resource": { "db2u": { "limits": { "cpu": "8", "memory": "15Gi" } } } } } }}'
- Wait for the c-db2oltp-iis-db2u-0 pod to restart.
- Exec into the iis-db2u pod:
oc exec -it c-db2oltp-iis-db2u-0 -- ksh
- Create the
update_mem.sh
script.cat <<EOF > /db2u/tmp/update_mem.sh #!/bin/bash source /etc/profile source /db2u/scripts/include/common_functions.sh source /db2u/scripts/include/db2_functions.sh # Get PID1 environ required for access OS envvar MEMORY_LIMIT export_pid1_env source /db2u/scripts/include/db2_memtune_functions.sh # Deactivate database and stop Db2 db2 terminate db2 force applications all db2 deactivate db XMETA db2 deactivate db IADB db2 deactivate db DSODB db2stop force rah 'ipclean -a' # Disable remote connections db2set DB2COMM -null # Update the normalized instance_memory % value derived from higher MEMORY_LIMIT rm -f /mnt/blumeta0/SystemConfig/instancememory # db2start prior to activate db bludb and connection within db2_autoconf.clp db2start set_instance_memory db2stop db2start # Re-run autoconfigure to start using updated instance_memory %, and reapply any overrides run_autoconfigure apply_cfg_setting_to_db2 "-all" # Re-enable Db2 remote connections, start Db2 and activate db db2stop force rah 'ipclean -a' db2set DB2COMM=TCPIP,SSL db2start db2 activate db XMETA db2 activate db IADB db2 activate db DSODB EOF
- Set the execute permission on the
update_mem.sh
script:chmod +x /db2u/tmp/update_mem.sh
- Run the script:
./db2u/tmp/update_mem.sh
Scale up wkc-db2u instance
Complete these steps:
- Specify the CPU and memory limit. In this example, CPU is set to 8 vCPU and memory is set to 15
Gi. Modify the values according to your
needs.
oc patch db2ucluster db2oltp-wkc --type=merge --patch '{"spec": { "podConfig": { "db2u": { "resource": { "db2u": { "limits": { "cpu": "8", "memory": "15Gi" } } } } } }}'
- Wait for the c-db2oltp-wkc-db2u-0 pod to restart.
- Exec into the wkc-db2u pod:
oc exec -it c-db2oltp-wkc-db2u-0 -- ksh
- Create the
update_mem.sh
script.cat <<EOF > /db2u/tmp/update_mem.sh #!/bin/bash source /etc/profile source /db2u/scripts/include/common_functions.sh source /db2u/scripts/include/db2_functions.sh # Get PID1 environ required for access OS envvar MEMORY_LIMIT export_pid1_env source /db2u/scripts/include/db2_memtune_functions.sh # Deactivate database and stop Db2 db2 terminate db2 force applications all db2 deactivate db ILGDB db2 deactivate db WFDB db2 deactivate db BGDB db2 deactivate db LINEAGE db2stop force rah 'ipclean -a' # Disable remote connections db2set DB2COMM -null # Update the normalized instance_memory % value derived from higher MEMORY_LIMIT rm -f /mnt/blumeta0/SystemConfig/instancememory # db2start prior to activate db bludb and connection within db2_autoconf.clp db2start set_instance_memory db2stop db2start # Re-run autoconfigure to start using updated instance_memory %, and reapply any overrides run_autoconfigure apply_cfg_setting_to_db2 "-all" # Re-enable Db2 remote connections, start Db2 and activate db db2stop force rah 'ipclean -a' db2set DB2COMM=TCPIP,SSL db2start db2 activate db ILGDB db2 activate db WFDB db2 activate db BGDB db2 activate db LINEAGE EOF
- Set the execute permission on the
update_mem.sh
script:chmod +x /db2u/tmp/update_mem.sh
- Run the script:
./db2u/tmp/update_mem.sh