Plans and Sizing

Plans

We provide a few preconfigured plans that should make sizing your PostgreSQL instance easier. Just choose one of the provided plans.

apiVersion: vshn.appcat.vshn.io/v1
kind: VSHNPostgreSQL
metadata:
  name: example
spec:
  parameters:
    size:
      plan: standard-2
  writeConnectionSecretToRef:
    name: postgres-creds

By default, the following plans are available on every cluster:

Plan CPU Memory Disk

standard-2

400m

1728Mi

20Gi

standard-4

900m

3776Mi

40Gi

standard-8

1900m

7872Mi

80Gi

Every PostgreSQL instance has a sidecar pod causing an overhead in memory consumption. This is the reason why, for example, the standard-4 plan provides less than 4Gi of usable memory. See section Sidecar Overhead below.

Depending on which cluster you’re working with, there might be some slight differences in available plans. You can see all available plans running:

$ kubectl explain vshnpostgresql.spec.parameters.size.plan

KIND:     VSHNPostgreSQL
VERSION:  vshn.appcat.vshn.io/v1

FIELD:    plan <string>

DESCRIPTION:
     Plan is the name of the resource plan that defines the compute resources.
     The following plans are available:

     standard-2 - CPU: 400m; Memory: 1936Mi; Disk: 20Gi

     standard-4 - CPU: 900m; Memory: 33984Mi; Disk: 40Gi

     standard-8 - CPU: 1900m; Memory: 8080Mi; Disk: 80Gi
About APPUiO Cloud

On APPUiO Cloud two important differences apply:

  • There is a plus-X variant of each plan, that will schedule the instance on a Plus Node. If you use the standard-X plans, the instance will be scheduled on a flex node.

  • The standard-8 plan is not available as it requests more memory than the Default Quota allows. If you need a larger instance, please contact APPUiO Cloud support and manually request more memory according to Custom Sizing.

Custom Sizing

While we provide some pre-configured plans, you are free to choose custom values for CPU, memory, and disk size. To do that simply set spec.parameters.size.cpu, spec.parameters.size.memory, or spec.parameters.size.disk.

The following example would keep the memory requests from the standard-2 plan while increasing the CPU request to 2 and the disk size to 36Gi.

apiVersion: vshn.appcat.vshn.io/v1
kind: VSHNPostgreSQL
metadata:
  name: example
spec:
  parameters:
    size:
      plan: standard-2
      cpu: "2"
      disk: 36Gi
  writeConnectionSecretToRef:
    name: postgres-creds

When specifying custom CPU or memory limits you need to be aware that there is an additional resource overhead of 320Mi of memory and 100m CPU for each PostgreSQL instance. See section Sidecar Overhead.

This means, if you for example set the memory request to 2000Mi, the instance will use, and you will be billed for, 2320Mi of RAM.

APPUiO Cloud Fair Use Policy

On APPUiO Cloud, the Fair Use Policy also applies to all AppCat Services by VSHN. You will be billed extra for CPU requests that exceed the memory to CPU ratio.

The default plans all adhere to the Fair Use Policy.

Sidecar Overhead

Each PostgreSQL Standalone instance has the following overhead:

  • CPU: 390m

  • Memory: 408Mi

These are for various sidecar containers that run alongside the actual PostgreSQL instance. These containers handle connection pooling, metrics and other internal functionality.

This overhead is already accounted for in the provided plans.

Configuring resource requests

By default, the resource requests and limits are set to the values defined in spec.parameters.size.cpu and spec.parameters.size.memory. If you want to explicitly set resource requests that are lower than the limit you need to define them in spec.parameters.size.requests.

We don’t recommend setting the requests to a lower value then the limit, as this might negatively impact the performance and stability of your instance.

Node Selectors

You can specify a custom node selector for your PostgreSQL instance. This allows you to assign the instance to a specific node, which can be helpful if your cluster has dedicated nodes to run databases on.

The following configuration would create a PostgreSQL instance that runs on a node with the label speed=fast.

apiVersion: vshn.appcat.vshn.io/v1
kind: VSHNPostgreSQL
metadata:
  name: example
spec:
  parameters:
    size:
      plan: standard-4
    scheduling:
      nodeSelector:
        speed: fast (1)
  writeConnectionSecretToRef:
    name: postgres-creds
1 Annotation specifying a faster node.

Please check the Kubernetes documentation on how to assign workloads to nodes using node selectors.

APPUiO Cloud Node Classes

On APPUiO Cloud, this can be used to schedule instances on specific Node Classes.

However, this can also be done by choosing the standard-x or plus-X plans, which will schedule the instance on flex or plus nodes.