Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Checklist:
Type of Changes:
What is the current behavior? (link to any open issues here)
What is the new behavior (if this is a feature change)?
I think this is a really nice one. The idea is to automatically tune postgresql parameters according to https://pgtune.leopard.in.ua/#/ which I've found very useful over the years.
This is quite simple as Patroni dynamic configuration is already implemented.
The PostgresCluster type now has a new field: AutoPGTune, which has two fields: AppType and HDType, all optional.
If AutoPGTune is set, postgresql parameters are tweaked using the memory and cpu requests, and AppType and HDType if defined. None of them are mandatory, related parameters will simply not be tweaked, and AppType is assumed mixed if no value is given.
Obviously this is optional and not mandatory, not set by default.
AutoPGTune uses Patroni DynamicConfiguration, so enabling this essentialy enables Patroni. I've thought about putting the AutoPGTune field under Patroni but it seems confusing as they're not directly related. I'll leave it for you to decide though.
Enabling/disabling AutoPGTune does not cause a restart.
If both AutoPGTune and Patroni.DynamicConfiguration are set, Patroni.DynamicConfiguration overrides AutoPGTune, e.g.
autoPgTune: hdType: ssd patroni: dynamicConfiugration: random_page_cost = 10 will set random_page_cost to 10 even though it should be 1.1 according to pgtune. Other parameters will be set though as they're not overriden.
Other information: