Browse Source

Apply PGTune recommendations to PostgreSQL in prod

This is just using the recommendations from PGTune for a web application
being hosted on a server with the prod server's specs. I'm sure they're
not the best values, but should be better than the defaults.
merge-requests/89/head
Deimos 5 years ago
parent
commit
078ca207f9
  1. 25
      salt/salt/postgresql/prod-config.sls
  2. 1
      salt/salt/top.sls

25
salt/salt/postgresql/prod-config.sls

@ -0,0 +1,25 @@
# Values from PGTune (https://pgtune.leopard.in.ua/)
{% set setting_values = {
"checkpoint_completion_target": "0.7",
"default_statistics_target": "100",
"effective_cache_size": "24GB",
"effective_io_concurrency": 200,
"maintenance_work_mem": "2GB",
"max_parallel_workers": "8",
"max_parallel_workers_per_gather": "4",
"max_wal_size": "2GB",
"max_worker_processes": "8",
"min_wal_size": "1GB",
"random_page_cost": "1.1",
"shared_buffers": "8GB",
"wal_buffers": "16MB",
"work_mem": "10485kB",
} %}
{% for setting, value in setting_values.items() %}
postgresql-conf-set-{{ setting }}:
file.replace:
- name: /etc/postgresql/{{ pillar['postgresql_version'] }}/main/postgresql.conf
- pattern: '^#?{{ setting }} = (?!{{ value }}).*$'
- repl: '{{ setting }} = {{ value }}'
{% endfor %}

1
salt/salt/top.sls

@ -31,6 +31,7 @@ base:
'prod':
- nginx.shortener-config
- nginx.static-sites-config
- postgresql.prod-config
- prod-config
'monitoring':
- nginx

Loading…
Cancel
Save