mirror of https://github.com/zulip/zulip.git
Add Zulip customizations to Postgres 9.5 config file.
This includes reasonable tuning of memory usage parameters based on the values that pgtune would use, roughly.
This commit is contained in:
parent
e818dff0b0
commit
ea089518ee
|
@ -57,6 +57,17 @@ vm.dirty_background_ratio = 5
|
|||
subscribe => [ Exec['pgtune'], File['/etc/sysctl.d/40-postgresql.conf'] ]
|
||||
}
|
||||
} else {
|
||||
# We can't use the built-in $memorysize fact because it's a string with human-readable units
|
||||
$total_memory = regsubst(file('/proc/meminfo'), '^.*MemTotal:\s*(\d+) kB.*$', '\1', 'M') * 1024
|
||||
$half_memory = $total_memory / 2
|
||||
$half_memory_pages = $half_memory / 4096
|
||||
$total_memory_mb = $total_memory / 1024 / 1024
|
||||
|
||||
$work_mem = $total_memory_mb / 512
|
||||
$shared_buffers = $total_memory_mb / 8
|
||||
$effective_cache_size = $total_memory_mb * 10 / 32
|
||||
$maintenance_work_mem = $total_memory_mb / 32
|
||||
|
||||
file { "/etc/postgresql/${zulip::base::postgres_version}/main/postgresql.conf":
|
||||
require => Package["postgresql-${zulip::base::postgres_version}"],
|
||||
ensure => file,
|
||||
|
|
|
@ -627,3 +627,31 @@ default_text_search_config = 'pg_catalog.english'
|
|||
#------------------------------------------------------------------------------
|
||||
|
||||
# Add settings for extensions here
|
||||
timezone = 'UTC'
|
||||
default_text_search_config = 'zulip.english_us_search'
|
||||
|
||||
log_destination = 'stderr'
|
||||
logging_collector = on
|
||||
log_directory = '/var/log/postgresql'
|
||||
log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log'
|
||||
log_rotation_age = 7d
|
||||
log_rotation_size = 100MB
|
||||
log_min_duration_statement = 500
|
||||
log_line_prefix = '%m [%c]: [%l-1] '
|
||||
log_checkpoints = on
|
||||
log_lock_waits = on
|
||||
log_temp_files = 0
|
||||
log_autovacuum_min_duration = 100
|
||||
|
||||
autovacuum_freeze_max_age = 2000000000
|
||||
vacuum_freeze_min_age = 1000000000
|
||||
vacuum_freeze_table_age = 1800000000
|
||||
|
||||
# Performance settings
|
||||
maintenance_work_mem = <%= scope["zulip::postgres_appdb_tuned::maintenance_work_mem"] %>MB
|
||||
effective_cache_size = <%= scope["zulip::postgres_appdb_tuned::effective_cache_size"] %>MB
|
||||
work_mem = <%= scope["zulip::postgres_appdb_tuned::work_mem"] %>MB
|
||||
shared_buffers = <%= scope["zulip::postgres_appdb_tuned::shared_buffers"] %>MB
|
||||
wal_buffers = 4MB
|
||||
checkpoint_completion_target = 0.7
|
||||
random_page_cost = 2.0
|
||||
|
|
Loading…
Reference in New Issue