diff --git a/servers/puppet/modules/humbug/files/postgresql/30-postgresql-shm.conf.master b/servers/puppet/modules/humbug/files/postgresql/30-postgresql-shm.conf.master deleted file mode 100644 index cec73b374e..0000000000 --- a/servers/puppet/modules/humbug/files/postgresql/30-postgresql-shm.conf.master +++ /dev/null @@ -1,13 +0,0 @@ -# Shared memory settings for PostgreSQL - -# Note that if another program uses shared memory as well, you will have to -# coordinate the size settings between the two. - -# Maximum size of shared memory segment in bytes -#kernel.shmmax = 33554432 - -# Maximum total size of shared memory in pages (normally 4096 bytes) -#kernel.shmall = 2097152 - -kernel.shmall = 6553600 -kernel.shmmax = 26843545600 diff --git a/servers/puppet/modules/humbug/files/postgresql/40-postgresql.conf.master b/servers/puppet/modules/humbug/files/postgresql/40-postgresql.conf.master new file mode 100644 index 0000000000..c24b37e081 --- /dev/null +++ b/servers/puppet/modules/humbug/files/postgresql/40-postgresql.conf.master @@ -0,0 +1,16 @@ +# Shared memory settings + +# Maximum total size of shared memory in pages (normally 4096 bytes) +kernel.shmall = 6553600 +# Maximum size of shared memory segment in bytes +kernel.shmmax = 26843545600 + +# Virtual memory settings +vm.swappiness = 0 +vm.overcommit_memory = 2 + +# We don't want these numbers to be too large or else performance +# will be too spiky. These seem to give a good balance between low +# numbers and sequential write performance +vm.dirty_ratio = 5 +vm.dirty_background_ratio = 2 diff --git a/servers/puppet/modules/humbug/files/postgresql/30-postgresql-shm.conf.slave b/servers/puppet/modules/humbug/files/postgresql/40-postgresql.conf.slave similarity index 54% rename from servers/puppet/modules/humbug/files/postgresql/30-postgresql-shm.conf.slave rename to servers/puppet/modules/humbug/files/postgresql/40-postgresql.conf.slave index 92062b609d..a883175e58 100644 --- a/servers/puppet/modules/humbug/files/postgresql/30-postgresql-shm.conf.slave +++ b/servers/puppet/modules/humbug/files/postgresql/40-postgresql.conf.slave @@ -1,13 +1,14 @@ # Shared memory settings for PostgreSQL -# Note that if another program uses shared memory as well, you will have to -# coordinate the size settings between the two. - -# Maximum size of shared memory segment in bytes -#kernel.shmmax = 33554432 - # Maximum total size of shared memory in pages (normally 4096 bytes) -#kernel.shmall = 2097152 - kernel.shmall = 1703936 +# Maximum size of shared memory segment in bytes kernel.shmmax = 6979321856 + +# Virtual memory settings +vm.swappiness = 0 +vm.overcommit_memory = 2 + +# These are the defaults on newer kernels +vm.dirty_ratio = 10 +vm.dirty_background_ratio = 5 diff --git a/servers/puppet/modules/humbug/manifests/postgres-common.pp b/servers/puppet/modules/humbug/manifests/postgres-common.pp index e7216b71b6..eec9ccc4b3 100644 --- a/servers/puppet/modules/humbug/manifests/postgres-common.pp +++ b/servers/puppet/modules/humbug/manifests/postgres-common.pp @@ -14,8 +14,8 @@ class humbug::postgres-common { } exec { "sysctl_p": - command => "/sbin/sysctl -p /etc/sysctl.d/30-postgresql-shm.conf", - subscribe => File['/etc/sysctl.d/30-postgresql-shm.conf'], + command => "/sbin/sysctl -p /etc/sysctl.d/40-postgresql.conf", + subscribe => File['/etc/sysctl.d/40-postgresql.conf'], refreshonly => true, } diff --git a/servers/puppet/modules/humbug/manifests/postgres-master.pp b/servers/puppet/modules/humbug/manifests/postgres-master.pp index c9133ea957..90c6f4e8bc 100644 --- a/servers/puppet/modules/humbug/manifests/postgres-master.pp +++ b/servers/puppet/modules/humbug/manifests/postgres-master.pp @@ -4,12 +4,17 @@ class humbug::postgres-master { $master_packages = [ "xfsprogs", "mdadm", ] package { $master_packages: ensure => "installed" } + # We bundle a bunch of other sysctl parameters into 40-postgresql.conf file { '/etc/sysctl.d/30-postgresql-shm.conf': + ensure => absent, + } + + file { '/etc/sysctl.d/40-postgresql.conf': ensure => file, owner => 'root', group => 'root', mode => 644, - source => 'puppet:///modules/humbug/postgresql/30-postgresql-shm.conf.master', + source => 'puppet:///modules/humbug/postgresql/40-postgresql.conf.master', } file { "/etc/postgresql/9.1/main/postgresql.conf": diff --git a/servers/puppet/modules/humbug/manifests/postgres-slave.pp b/servers/puppet/modules/humbug/manifests/postgres-slave.pp index 734d0bc347..108f7f4a1a 100644 --- a/servers/puppet/modules/humbug/manifests/postgres-slave.pp +++ b/servers/puppet/modules/humbug/manifests/postgres-slave.pp @@ -1,12 +1,17 @@ class humbug::postgres-slave { class { 'humbug::postgres-common': } + # We bundle a bunch of other sysctl parameters into 40-postgresql.conf file { '/etc/sysctl.d/30-postgresql-shm.conf': + ensure => absent, + } + + file { '/etc/sysctl.d/40-postgresql.conf': ensure => file, owner => 'root', group => 'root', mode => 644, - source => 'puppet:///modules/humbug/postgresql/30-postgresql-shm.conf.slave', + source => 'puppet:///modules/humbug/postgresql/40-postgresql.conf.slave', } file { "/etc/postgresql/9.1/main/postgresql.conf":