Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(helm): add support for pgbouncer (#818) #818

Merged
merged 2 commits into from
Aug 26, 2024

Conversation

mdonadoni
Copy link
Member

@mdonadoni mdonadoni commented Aug 6, 2024

Closes #819

Copy link

codecov bot commented Aug 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 19.22%. Comparing base (cd94d12) to head (04082f4).
Report is 24 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #818   +/-   ##
=======================================
  Coverage   19.22%   19.22%           
=======================================
  Files          26       26           
  Lines        2512     2512           
=======================================
  Hits          483      483           
  Misses       2029     2029           
---- 🚨 Try these New Features:

mdonadoni added a commit to mdonadoni/reana that referenced this pull request Aug 6, 2024
mdonadoni added a commit to mdonadoni/reana that referenced this pull request Aug 6, 2024
mdonadoni added a commit to mdonadoni/reana that referenced this pull request Aug 6, 2024
mdonadoni added a commit to mdonadoni/reana that referenced this pull request Aug 9, 2024
helm/reana/values.yaml Outdated Show resolved Hide resolved
@@ -98,6 +98,12 @@ This Helm automatically prefixes all names using the release name to avoid colli
| `reana_hostname` | REANA hostname (e.g. reana.example.org) | None |
| `namespace_runtime` | Namespace in which the REANA runtime pods (workflow engines, jobs etc...) will run | `.Release.Namespace` |
| `naming_scheme` | REANA component naming scheme | None |
| `pgbouncer.enabled` | Instantiate PgBouncer inside the cluster to pool database connections | false |
Copy link
Member

Choose a reason for hiding this comment

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

When pgbouncer is enabled, shall we act on reana-job-controller's REANA_DB_CLOSE_POOL_CONNECTIONS configuration value?

Copy link
Member Author

@mdonadoni mdonadoni Aug 23, 2024

Choose a reason for hiding this comment

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

No, it's actually the opposite, if pgbouncer is not enabled then the two options are:

  • increase the number of connection slots of the database
  • close the connections as soon as they are returned to SQLAlchemy's connection pool by setting REANA_DB_CLOSE_POOL_CONNECTIONS appropriately

I have kept the default value of REANA_DB_CLOSE_POOL_CONNECTIONS as to have the best performance possible, but it is customisable so that we can revert back the change in case of troubles with PgBouncer.

What do you think we should do regarding this? Shall we add this to the documentation?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, we can later improve the scalability-related documentation regarding PgBouncer.

@@ -0,0 +1,17 @@
apiVersion: v1
Copy link
Member

Choose a reason for hiding this comment

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

Hmm, I wonder whether it would be possible to amend the setup to automatically delete / refresh reana-server and reana-workflow-controller pods when the admin changes PgBouncer from enabled to disabled and vice versa? (Currently in addition to helm diff upgrade... one has to do it manually.)

This comment is a sort of a "bonus", the things work nicely 👍 and I'm not sure whether admins would attempt to play with enabling/disabling PgBouncer dynamically in reality... Well we could always simply explain this in the documentation.

Copy link
Member Author

Choose a reason for hiding this comment

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

I have updated the PR to also roll the deployments of pgbouncer/r-server/r-w-controller when the database config (configmap or secrets) change. This can be used as a blueprint to do the same for the other config/secret that might change over time.

mdonadoni added a commit to mdonadoni/reana that referenced this pull request Aug 23, 2024
Automatically restart deployed pods when the database configuration
changes by setting the checksums of the ConfigMaps and Secrets as
annotations of the pod.
mdonadoni added a commit to mdonadoni/reana that referenced this pull request Aug 23, 2024
Automatically restart deployed pods when the database configuration
changes by setting the checksums of the ConfigMaps and Secrets as
annotations of the pod.
Automatically restart deployed pods when the database configuration
changes by setting the checksums of the ConfigMaps and Secrets as
annotations of the pod.
Copy link
Member

@tiborsimko tiborsimko left a comment

Choose a reason for hiding this comment

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

Works nicely 👍 Including deployment rollout in case of DB config chnges

@mdonadoni mdonadoni merged commit 04082f4 into reanahub:master Aug 26, 2024
12 checks passed
@mdonadoni mdonadoni deleted the pgbouncer branch August 26, 2024 13:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

db: add support for PgBouncer
2 participants