Skip to content
This repository has been archived by the owner on Feb 22, 2022. It is now read-only.

[stable/postgresql] Add dedicated tmpfs for /dev/shm. #19025

Merged
merged 2 commits into from
Nov 21, 2019
Merged

[stable/postgresql] Add dedicated tmpfs for /dev/shm. #19025

merged 2 commits into from
Nov 21, 2019

Conversation

desaintmartin
Copy link
Collaborator

@desaintmartin desaintmartin commented Nov 20, 2019

What this PR does / why we need it:

Start a database pod without limitations on shm memory. By default docker
limit to 64MB (see e.g. the docker
issue
, which could be
not enough if PostgreSQL uses parallel workers heavily. If this option is
present and value is , to the target database pod will be mounted a new
tmpfs volume to remove this limitation.

Checklist

[Place an '[x]' (no spaces) in all applicable fields. Please remove unrelated fields.]

  • DCO signed
  • Chart Version bumped
  • Variables are documented in the README.md
  • Title of the PR starts with chart name (e.g. [stable/mychartname])

@helm-bot helm-bot added the Contribution Allowed If the contributor has signed the DCO or the CNCF CLA (prior to the move to a DCO). label Nov 20, 2019
@helm-bot helm-bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Nov 20, 2019
@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 20, 2019
@@ -116,6 +116,7 @@ The following tables lists the configurable parameters of the PostgreSQL chart a
| `service.loadBalancerIP` | loadBalancerIP if service type is `LoadBalancer` | `nil` |
| `service.loadBalancerSourceRanges` | Address that are allowed when svc is LoadBalancer | [] |
| `schedulerName` | Name of the k8s scheduler (other than default) | `nil` |
| `enableShmVolume` | Enable emptyDir volume for /dev/shm | `true` |
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it okay for you to have, like persistence, one global value to enable for both master and slaves?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but please add that information to the Description:

Enable emptyDir volume for /dev/shm both on master and slaves replicas

@desaintmartin desaintmartin changed the title [stable/postgresql] Add dedicated tmpsfs for /dev/shm. [stable/postgresql] Add dedicated tmpfs for /dev/shm. Nov 20, 2019
Copy link
Collaborator

@juan131 juan131 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @desaintmartin

Thanks so much for this contribution! I quick question:

  • Are containers affected by this limitation when using containerd as runtime too?

@@ -116,6 +116,7 @@ The following tables lists the configurable parameters of the PostgreSQL chart a
| `service.loadBalancerIP` | loadBalancerIP if service type is `LoadBalancer` | `nil` |
| `service.loadBalancerSourceRanges` | Address that are allowed when svc is LoadBalancer | [] |
| `schedulerName` | Name of the k8s scheduler (other than default) | `nil` |
| `enableShmVolume` | Enable emptyDir volume for /dev/shm | `true` |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but please add that information to the Description:

Enable emptyDir volume for /dev/shm both on master and slaves replicas

stable/postgresql/templates/statefulset-slaves.yaml Outdated Show resolved Hide resolved
stable/postgresql/templates/statefulset-slaves.yaml Outdated Show resolved Hide resolved
@desaintmartin
Copy link
Collaborator Author

Hi @desaintmartin

Thanks so much for this contribution! I quick question:

* Are containers affected by this limitation when using [containerd](https://containerd.io/) as runtime too?

Hm, this is not clear: containerd/containerd#3654 states that the default is 64MB (with source as reference) and containerd/containerd@20d3fae solves it but I can't see this function called anywhere in containerd repo.
So I would say that by default, it is still 64MB.

@desaintmartin
Copy link
Collaborator Author

desaintmartin commented Nov 21, 2019

Actually, I realized that if persistence is not enabled, chmod won't run. Fixing.

Start a database pod without limitations on shm memory. By default docker
limit  to  (see e.g. the [docker
issue](docker-library/postgres#416), which could be
not enough if PostgreSQL uses parallel workers heavily. If this option is
present and value is , to the target database pod will be mounted a new
tmpfs volume to remove this limitation.

Signed-off-by: Cédric de Saint Martin <cdesaintmartin@wiremind.fr>
@helm-bot helm-bot removed the Contribution Allowed If the contributor has signed the DCO or the CNCF CLA (prior to the move to a DCO). label Nov 21, 2019
Signed-off-by: Cédric de Saint Martin <cdesaintmartin@wiremind.fr>
@helm-bot helm-bot added the Contribution Allowed If the contributor has signed the DCO or the CNCF CLA (prior to the move to a DCO). label Nov 21, 2019
Copy link
Collaborator

@juan131 juan131 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @desaintmartin !

Let's merge this and wait for docker/containerd to provide a better solution

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Nov 21, 2019
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: desaintmartin, juan131

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot merged commit 9830a92 into helm:master Nov 21, 2019
JoseAlban pushed a commit to JoseAlban/charts that referenced this pull request Nov 22, 2019
* [stable/postgresql] Add dedicated tmpsfs for /dev/shm.

Start a database pod without limitations on shm memory. By default docker
limit  to  (see e.g. the [docker
issue](docker-library/postgres#416), which could be
not enough if PostgreSQL uses parallel workers heavily. If this option is
present and value is , to the target database pod will be mounted a new
tmpfs volume to remove this limitation.

Signed-off-by: Cédric de Saint Martin <cdesaintmartin@wiremind.fr>

* [stable/postgresql] SHM: Second version after review + improvements.

Signed-off-by: Cédric de Saint Martin <cdesaintmartin@wiremind.fr>
crmarques pushed a commit to crmarques/charts that referenced this pull request Nov 29, 2019
* [stable/postgresql] Add dedicated tmpsfs for /dev/shm.

Start a database pod without limitations on shm memory. By default docker
limit  to  (see e.g. the [docker
issue](docker-library/postgres#416), which could be
not enough if PostgreSQL uses parallel workers heavily. If this option is
present and value is , to the target database pod will be mounted a new
tmpfs volume to remove this limitation.

Signed-off-by: Cédric de Saint Martin <cdesaintmartin@wiremind.fr>

* [stable/postgresql] SHM: Second version after review + improvements.

Signed-off-by: Cédric de Saint Martin <cdesaintmartin@wiremind.fr>
Signed-off-by: Carlos Roberto Marques Junior <carlos.marques@bndes.gov.br>
hakman pushed a commit to hakman/charts that referenced this pull request Dec 5, 2019
* [stable/postgresql] Add dedicated tmpsfs for /dev/shm.

Start a database pod without limitations on shm memory. By default docker
limit  to  (see e.g. the [docker
issue](docker-library/postgres#416), which could be
not enough if PostgreSQL uses parallel workers heavily. If this option is
present and value is , to the target database pod will be mounted a new
tmpfs volume to remove this limitation.

Signed-off-by: Cédric de Saint Martin <cdesaintmartin@wiremind.fr>

* [stable/postgresql] SHM: Second version after review + improvements.

Signed-off-by: Cédric de Saint Martin <cdesaintmartin@wiremind.fr>
dargolith pushed a commit to dargolith/charts that referenced this pull request Jan 10, 2020
* [stable/postgresql] Add dedicated tmpsfs for /dev/shm.

Start a database pod without limitations on shm memory. By default docker
limit  to  (see e.g. the [docker
issue](docker-library/postgres#416), which could be
not enough if PostgreSQL uses parallel workers heavily. If this option is
present and value is , to the target database pod will be mounted a new
tmpfs volume to remove this limitation.

Signed-off-by: Cédric de Saint Martin <cdesaintmartin@wiremind.fr>

* [stable/postgresql] SHM: Second version after review + improvements.

Signed-off-by: Cédric de Saint Martin <cdesaintmartin@wiremind.fr>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. Contribution Allowed If the contributor has signed the DCO or the CNCF CLA (prior to the move to a DCO). lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants