more autotuning

This commit is contained in:
ace 2024-01-29 13:33:07 +03:00
parent 622551768a
commit adab430df7
Signed by: ace
GPG Key ID: 2C08973DD37A76FD

View File

@ -109,10 +109,12 @@ patroni_postgresql_backup_parameters:
restore_command: "{{ patroni_postgresql_restore_command if patroni_wal_g_install else 'cd .' }}"
# postgresql parameters to bootstrap dcs (are parameters for example)
patroni_postgresql_max_connections: "1000"
patroni_storage_type: 'ssd'
patroni_postgresql_default_parameters:
archive_mode: "on"
archive_timeout: "1800s"
max_connections: "1000"
max_connections: "{{ patroni_postgresql_max_connections }}"
superuser_reserved_connections: "5"
password_encryption: "{{ patroni_postgresql_password_encryption_algorithm }}"
max_locks_per_transaction: "64"
@ -122,18 +124,18 @@ patroni_postgresql_default_parameters:
max_parallel_workers: "{{ ansible_processor_vcpus }}"
max_parallel_workers_per_gather: "{{ (ansible_processor_vcpus / 2) | round | int }}"
max_parallel_maintenance_workers: "{{ (ansible_processor_vcpus / 2) | round | int }}"
work_mem: "128MB"
maintenance_work_mem: "256MB"
effective_cache_size: "4GB"
work_mem: "{{ (((ansible_memory_mb.real.total - ((ansible_memory_mb.real.total * 0.25) | round | int)) / (patroni_postgresql_max_connections | int * 3) / ((ansible_processor_vcpus / 2) | round | int)) + 4) | round | int }}MB"
maintenance_work_mem: "{{ (ansible_memory_mb.real.total * 0.0625) | round | int }}MB"
effective_cache_size: "{{ (ansible_memory_mb.real.total * 0.8) | round | int }}MB"
checkpoint_timeout: "15min"
checkpoint_completion_target: "0.9"
min_wal_size: "2GB"
max_wal_size: "8GB"
wal_buffers: "32MB"
min_wal_size: "1GB"
max_wal_size: "4GB"
wal_buffers: "16MB"
default_statistics_target: "1000"
seq_page_cost: "1"
random_page_cost: "4"
effective_io_concurrency: "2"
random_page_cost: "{{ '1.1' if patroni_storage_type == 'ssd' else '4' }}"
effective_io_concurrency: "{{ '200' if patroni_storage_type == 'ssd' else '2' }}"
synchronous_commit: "on"
autovacuum: "on"
autovacuum_max_workers: "5"