percona-postgresql-operator icon indicating copy to clipboard operation
percona-postgresql-operator copied to clipboard

Powers of 2 storage sizing units

Open hubvu opened this issue 2 years ago • 4 comments

  • This PR makes a small change to the cr-minimal.yaml and cr.yaml manifests to prefer usage of storage size units based on powers of 2, for example Giinstead of G.
  • References
    • https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#resource-units-in-kubernetes
    • https://kubernetes.io/docs/reference/kubernetes-api/common-definitions/quantity/
    • https://en.wikipedia.org/wiki/Byte#Multiple-byte_units

hubvu avatar Apr 15 '22 18:04 hubvu

Hi @hubvu Thank you for submitting this PR. In order to evaluate it properly, could you please share with us your vision on it? Maybe it solves your issues? Or you have some other use-case. Feel free to post it here in comments

cap1984 avatar Jun 30 '22 13:06 cap1984

Test name Status
demand-backup passed
init-deploy failed
upgrade passed
scaling passed
smart-update passed
recreate failed
version-service failed
scheduled-backup passed
affinity passed
monitoring failed
self-healing passed
operator-self-healing passed
clone-cluster passed
tls-check passed
users passed
ns-mode passed

commit: https://github.com/percona/percona-postgresql-operator/pull/251/commits/cb2bb152ab8c0b107582e57350a5a6dcf7a45eb0 image: perconalab/percona-postgresql-operator:PR-251-cb2bb152-pgo-apiserver

image: perconalab/percona-postgresql-operator:PR-251-cb2bb152-pgo-event

image: perconalab/percona-postgresql-operator:PR-251-cb2bb152-pgo-rmdata

image: perconalab/percona-postgresql-operator:PR-251-cb2bb152-pgo-scheduler

image: perconalab/percona-postgresql-operator:PR-251-cb2bb152-postgres-operator

image: perconalab/percona-postgresql-operator:PR-251-cb2bb152-pgo-deployer

JNKPercona avatar Aug 11 '22 08:08 JNKPercona

Hi @cap1984, apologies for the delay and for sure I can give you a clearer reasoning around this PR - its a proposal to use the iB byte unit instead of the B byte unit as;

  • 1 kilobyte (symbol kB) == 1,000 bytes, whereas
  • 1 kibibyte (symbol KiB) == 1,024 bytes.

From the vmstat man page;

All linux blocks are currently 1024 bytes. Old kernels may report blocks as 512 bytes, 2048 bytes, or 4096 bytes. Since procps 3.1.9, vmstat lets you choose units (k, K, m, M). Default is K (1024 bytes) in the default mode.

What it resolves is a common issue you see when trying to deploy stateful applications with Kubernetes persistent storage solutions such as Ondat which conforms to using the default kernel block size -- 1024 bytes as compared to 1000.


Take for example - when I deploy https://github.com/percona/percona-postgresql-operator and apply the default custom resource from the Quick start Installation guidance, the event error message that shows up against the PVC objects is demonstrated below;

$ kubectl describe pvc --namespace pgo

Name:          cluster1
Namespace:     pgo
StorageClass:  storageos
Status:        Pending
Volume:
Labels:        pg-cluster=cluster1
               vendor=crunchydata
Annotations:   storageos.com/storageclass: 81e66e90-9140-47ac-8648-c17bbdb7ab8a
               volume.beta.kubernetes.io/storage-provisioner: csi.storageos.com
               volume.kubernetes.io/storage-provisioner: csi.storageos.com
Finalizers:    [kubernetes.io/pvc-protection]
Capacity:
Access Modes:
VolumeMode:    Filesystem
Used By:       <none>
Events:
  Type     Reason                Age                   From                                                                                          Message
  ----     ------                ----                  ----                                                                                          -------
  Normal   Provisioning          4m10s (x10 over 10m)  csi.storageos.com_storageos-csi-helper-6bf49c4bd5-fb4wn_ac8d4cb4-3ac4-4766-9cef-2037af393fef  External provisioner is provisioning volume for claim "pgo/cluster1"
  Warning  ProvisioningFailed    4m8s (x10 over 10m)   csi.storageos.com_storageos-csi-helper-6bf49c4bd5-fb4wn_ac8d4cb4-3ac4-4766-9cef-2037af393fef  failed to provision volume with StorageClass "storageos": rpc error: code = OutOfRange desc = unsupported capacity size: 1000000000
  Normal   ExternalProvisioning  44s (x42 over 10m)    persistentvolume-controller                                                                   waiting for a volume to be created, either by external provisioner "csi.storageos.com" or manually created by system administrator


Name:          cluster1-pgbr-repo
Namespace:     pgo
StorageClass:  storageos
Status:        Pending
Volume:
Labels:        pg-cluster=cluster1
               vendor=crunchydata
Annotations:   storageos.com/storageclass: 81e66e90-9140-47ac-8648-c17bbdb7ab8a
               volume.beta.kubernetes.io/storage-provisioner: csi.storageos.com
               volume.kubernetes.io/storage-provisioner: csi.storageos.com
Finalizers:    [kubernetes.io/pvc-protection]
Capacity:
Access Modes:
VolumeMode:    Filesystem
Used By:       cluster1-backrest-shared-repo-77b9566957-f8jfv
Events:
  Type     Reason                Age                   From                                                                                          Message
  ----     ------                ----                  ----                                                                                          -------
  Normal   Provisioning          4m10s (x10 over 10m)  csi.storageos.com_storageos-csi-helper-6bf49c4bd5-fb4wn_ac8d4cb4-3ac4-4766-9cef-2037af393fef  External provisioner is provisioning volume for claim "pgo/cluster1-pgbr-repo"
  Warning  ProvisioningFailed    4m9s (x10 over 10m)   csi.storageos.com_storageos-csi-helper-6bf49c4bd5-fb4wn_ac8d4cb4-3ac4-4766-9cef-2037af393fef  failed to provision volume with StorageClass "storageos": rpc error: code = OutOfRange desc = unsupported capacity size: 1000000000
  Normal   ExternalProvisioning  29s (x42 over 10m)    persistentvolume-controller                                                                   waiting for a volume to be created, either by external provisioner "csi.storageos.com" or manually created by system administrator

To address the failed to provision volume with StorageClass "storageos": rpc error: code = OutOfRange desc = unsupported capacity size: 1000000000 provisioning issue - using the storage size units based on powers of 2 (Ei, Pi, Ti, Gi, Mi, Ki) works.


We can also compare the cr.yaml and cr-minimal.yaml manifests from https://github.com/percona/percona-server-mongodb-operator/ which use storage size units based on powers of 2 and that works with no issues;

  • https://github.com/percona/percona-server-mongodb-operator/blob/main/deploy/cr-minimal.yaml#L33
  • https://github.com/percona/percona-server-mongodb-operator/blob/main/deploy/cr-minimal.yaml#L22
  • https://github.com/percona/percona-server-mongodb-operator/blob/main/deploy/cr.yaml#L183
  • https://github.com/percona/percona-server-mongodb-operator/blob/main/deploy/cr.yaml#L240
  • https://github.com/percona/percona-server-mongodb-operator/blob/main/deploy/cr.yaml#L357

Let me know what you think and if you need anything else.

Thanks!

hubvu avatar Aug 31 '22 14:08 hubvu

CLA assistant check
All committers have signed the CLA.

it-percona-cla avatar Sep 11 '22 22:09 it-percona-cla

Test name Status
version-service passed
demand-backup passed
scheduled-backup passed
upgrade passed
init-deploy passed
smart-update passed
scaling passed
recreate passed
affinity passed
monitoring passed
self-healing passed
operator-self-healing passed
clone-cluster passed
tls-check passed
users passed
ns-mode passed
We run 16 out of 16

commit: https://github.com/percona/percona-postgresql-operator/pull/251/commits/1f85a0dc6d5ecc988df6ef549d9c93c3a56899c8 image: perconalab/percona-postgresql-operator:PR-251-1f85a0dc-pgo-apiserver

image: perconalab/percona-postgresql-operator:PR-251-1f85a0dc-pgo-event

image: perconalab/percona-postgresql-operator:PR-251-1f85a0dc-pgo-rmdata

image: perconalab/percona-postgresql-operator:PR-251-1f85a0dc-pgo-scheduler

image: perconalab/percona-postgresql-operator:PR-251-1f85a0dc-postgres-operator

image: perconalab/percona-postgresql-operator:PR-251-1f85a0dc-pgo-deployer

JNKPercona avatar Mar 09 '23 15:03 JNKPercona

@hubvu thank you for contribution

hors avatar Mar 10 '23 08:03 hors

Hello, @hubvu ! Thank you for your contributions! We would like to send you a gift from Percona. Please, contact us at [email protected].

Aleksa-del avatar Nov 30 '23 14:11 Aleksa-del