-
-
Save danieldreier/a9a20e2dee7d2db955c2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# == Class riak::tuning | |
# | |
# This class performs system performance tuning | |
# This is based on @Cornellio's work from | |
# https://github.com/Cornellio/puppet-riak/blob/master/manifests/baseconfig.pp | |
# We're trying to implement the recommendations in | |
# http://docs.basho.com/riak/1.3.2/cookbooks/Linux-Performance-Tuning/ | |
# if we're on AWS, we should implement the recommendations in | |
# http://docs.basho.com/riak/1.3.2/cookbooks/Performance-Tuning-AWS/ | |
# (specifically, use the deadline scheduler on EBS volumes) | |
# We want to: | |
# - increase open files limit - http://docs.basho.com/riak/1.3.2/cookbooks/Open-Files-Limit/ | |
# | |
# - set noatime,data=writeback,barrier=0 on the volume we've mounted riak data to | |
# - sysctl.conf kernel settings, mostly TCP settings | |
# vm.swappiness = 0 | |
# net.ipv4.tcp_max_syn_backlog = 40000 | |
# net.core.somaxconn=4000 | |
# net.ipv4.tcp_timestamps = 0 | |
# net.ipv4.tcp_sack = 1 | |
# net.ipv4.tcp_window_scaling = 1 | |
# net.ipv4.tcp_fin_timeout = 15 | |
# net.ipv4.tcp_keepalive_intvl = 30 | |
# net.ipv4.tcp_tw_reuse = 1 | |
# if we have a 10Gb network, we want: | |
# net.core.rmem_default = 8388608 | |
# net.core.rmem_max = 8388608 | |
# net.core.wmem_default = 8388608 | |
# net.core.wmem_max = 8388608 | |
# net.core.netdev_max_backlog = 10000 | |
# - ulimit settings | |
# - disable swap entirely | |
class riak::tuning { | |
case $::osfamily { | |
'Debian', 'RedHat', 'Amazon': { | |
# set kernel io scheduler | |
# http://docs.basho.com/riak/latest/ops/tuning/linux/ | |
# Scheduler recommendations: | |
# The noop scheduler when deploying on iSCSI over HBAs, or any hardware-based RAID. | |
# The deadline scheduler when using SSD-based storage. | |
# by default, set to deadline | |
# if EBS, set to deadline | |
# if SSD, set to noop | |
# increase the scheduler depth to 1024 | |
# echo 1024 > /sys/block/sda/queue/nr_requests | |
# how about setting it permanently? | |
# filesystem options | |
# use ext4 on linux | |
# use ZFS on BSD or Solaris | |
mount { '/': | |
options => 'defaults,noatime,barrier=0,data=writeback', | |
} | |
# Optional I/O Settings | |
# If your cluster is experiencing excessive I/O blocking, the following settings may help prevent disks from being overwhelmed during periods of high write activity at the expense of peak performance for spiky workloads: | |
# vm.dirty_background_ratio = 0 | |
# vm.dirty_background_bytes = 209715200 | |
# vm.dirty_ratio = 40 | |
# vm.dirty_bytes = 0 | |
# vm.dirty_writeback_centisecs = 100 | |
# vm.dirty_expire_centisecs = 200 | |
# These settings have been tested and benchmarked by Basho in nodes with 16 GB of RAM. | |
mount { '/': | |
ensure => 'mounted', | |
dump => '1', | |
fstype => 'ext4', | |
options => 'noatime,data=writeback,barrier=0', | |
pass => '1', | |
target => '/etc/fstab', | |
} | |
augeas { 'kernel-params': | |
context => '/files/etc/sysctl.conf', | |
changes => [ | |
"set fs.file-max[1] ${riak::sysctl_fs_file_max}", | |
'set vm.swappiness[1] 0', | |
'set net.ipv4.tcp_max_syn_backlog[1] 40000', | |
'set net.core.somaxconn[1] 4000', | |
'set net.ipv4.tcp_timestamps[1] 0', | |
'set net.ipv4.tcp_sack[1] 1', | |
'set net.ipv4.tcp_window_scaling[1] 1', | |
'set net.ipv4.tcp_fin_timeout[1] 15', | |
'set net.ipv4.tcp_keepalive_intvl[1] 30', | |
'set net.ipv4.tcp_tw_reuse[1] 1', | |
'set net.core.rmem_default[1] 8388608', | |
'set net.core.rmem_max[1] 8388608', | |
'set net.core.wmem_default[1] 8388608', | |
'set net.core.wmem_max[1] 8388608', | |
'set net.core.netdev_max_backlog[1] 10000', | |
], | |
before => Exec['load-kernel-params'], | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment