puppet: Add vm sysctl settings to Postgres configs

(imported from commit e557815f490a603da635fb60d39569346a72aa85)
This commit is contained in:
Zev Benjamin 2013-04-17 16:21:03 -04:00
parent a13b929d1f
commit 387f63deaa
6 changed files with 39 additions and 25 deletions

View File

@ -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

View File

@ -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

View File

@ -1,13 +1,14 @@
# Shared memory settings for PostgreSQL # 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) # Maximum total size of shared memory in pages (normally 4096 bytes)
#kernel.shmall = 2097152
kernel.shmall = 1703936 kernel.shmall = 1703936
# Maximum size of shared memory segment in bytes
kernel.shmmax = 6979321856 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

View File

@ -14,8 +14,8 @@ class humbug::postgres-common {
} }
exec { "sysctl_p": exec { "sysctl_p":
command => "/sbin/sysctl -p /etc/sysctl.d/30-postgresql-shm.conf", command => "/sbin/sysctl -p /etc/sysctl.d/40-postgresql.conf",
subscribe => File['/etc/sysctl.d/30-postgresql-shm.conf'], subscribe => File['/etc/sysctl.d/40-postgresql.conf'],
refreshonly => true, refreshonly => true,
} }

View File

@ -4,12 +4,17 @@ class humbug::postgres-master {
$master_packages = [ "xfsprogs", "mdadm", ] $master_packages = [ "xfsprogs", "mdadm", ]
package { $master_packages: ensure => "installed" } 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': file { '/etc/sysctl.d/30-postgresql-shm.conf':
ensure => absent,
}
file { '/etc/sysctl.d/40-postgresql.conf':
ensure => file, ensure => file,
owner => 'root', owner => 'root',
group => 'root', group => 'root',
mode => 644, 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": file { "/etc/postgresql/9.1/main/postgresql.conf":

View File

@ -1,12 +1,17 @@
class humbug::postgres-slave { class humbug::postgres-slave {
class { 'humbug::postgres-common': } class { 'humbug::postgres-common': }
# We bundle a bunch of other sysctl parameters into 40-postgresql.conf
file { '/etc/sysctl.d/30-postgresql-shm.conf': file { '/etc/sysctl.d/30-postgresql-shm.conf':
ensure => absent,
}
file { '/etc/sysctl.d/40-postgresql.conf':
ensure => file, ensure => file,
owner => 'root', owner => 'root',
group => 'root', group => 'root',
mode => 644, 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": file { "/etc/postgresql/9.1/main/postgresql.conf":