Overriding resources for Postgres components on OpenShift

In 10.0.4.0 and greater, you can optionally override the CPU and Memory resources used by postgres database components.

About this task

There are three postgres components:

  • postgres
  • pgBouncer
  • pgBackRest

The default resources used in postgrespgBouncer and pgBackRest components are:

Table 1. Postgres component default resources
Resource Postgres DB pgBouncer pgBackRest
Memory Request 512Mi 24Mi 48Mi
Memory Limit 8Gi 128Mi 128Mi
CPU Request 600m 80m 80m
CPU Limit 1500m 200m 200m

Procedure

To override resources, complete the following procedure

  1. Prepare a patch yaml.
    • Ensure that you specify the name of the container for the resource you want to override. Names:

      • postgres
      • pgBouncer
      • pgBackRest
    • You can override multiple postgres components in parallel. Adding one container section under mgmt-pgcluster template.
    • You can override just a single value, such as CPU limit.
    Examples:
    • Example yaml, to replace all postgres DB resources:
      spec:
        template:
        - name: mgmt-pgcluster
          containers:
          - name: postgres
            resources:
              requests:
                cpu: 1500m
                memory: 8Gi
              limits:
                cpu: 600m
                memory: 512Mi
    • Example yaml, to replace all pgBouncer resources:
      spec:
        template:
        - name: mgmt-pgcluster
          containers:
          - name: pgBouncer
            resources:
              requests:
                cpu: 200m
                memory: 128Mi
              limits:
                cpu: 300m
                memory: 256Mi
      
    • Example yaml,to replace CPU limit of postgres database:
      spec:
        template:
        - name: mgmt-pgcluster
          containers:
          - name: postgres
            resources:
              limits:
                cpu: 1000m
    • Example yaml, to replace CPU limits of postgres DB and pgBouncer:
      spec:
        template:
        - name: mgmt-pgcluster
          containers:
          - name: postgres
            resources:
              limits:
                cpu: 1000m
          - name: pgBouncer
            resources:
              limits:
                cpu: 1000m
  2. Apply the patch yaml:
    oc patch apiconnectcluster <apiconnectcluster-cr-name> --type merge --patch "$(cat patch.yaml)"

Results

The postgres components will restart with updated values.