bundles/postgresql: add metadata keys for some performance related config options

This commit is contained in:
Franzi 2021-04-23 14:02:04 +02:00
parent 616feb54b2
commit 8b14575657
Signed by: kunsi
GPG key ID: 12E3D2136B818350
3 changed files with 34 additions and 5 deletions

View file

@ -77,3 +77,27 @@ def default_postgresql_version_for_debian(metadata):
'version': version_to_be_installed,
},
}
@metadata_reactor.provides(
'postgresql/effective_io_concurrency',
'postgresql/max_worker_processes',
'postgresql/max_parallel_workers',
'postgresql/max_parallel_workers_per_gather',
)
def worker_processes(metadata):
return {
'postgresql': {
# This is the amount of parallel I/O Operations the
# postgresql process is allowed to do on disk. We set
# this to max_connections by default.
'effective_io_concurrency': metadata.get('postgresql/max_connections'),
# Try to request one worker process per 10 configured
# connections. The default is 8 for both of these values.
'max_worker_processes': int(metadata.get('postgresql/max_connections')/10),
'max_parallel_workers': int(metadata.get('postgresql/max_connections')/10),
# default 2
'max_parallel_workers_per_gather': max(int(metadata.get('postgresql/max_connections')/100), 2),
},
}