Swift: Refact tweaking using define
* sysctl::value instead of file/exec * kmod::load instead of file/exec * logrotate::rule instead of file Change-Id: I62bebd9ff5c5c66661481215a258b811c6c1300d
This commit is contained in:
parent
eeb8db61ca
commit
db9db04d7c
@ -16,68 +16,39 @@
|
|||||||
# Swift tweaking
|
# Swift tweaking
|
||||||
#
|
#
|
||||||
class cloud::object::tweaking {
|
class cloud::object::tweaking {
|
||||||
file {'/etc/sysctl.d/swift-tuning.conf':
|
kmod::load { 'ip_conntrack': }
|
||||||
content => "
|
|
||||||
# disable TIME_WAIT.. wait..
|
|
||||||
net.ipv4.tcp_tw_recycle=1
|
|
||||||
net.ipv4.tcp_tw_reuse=1
|
|
||||||
|
|
||||||
# disable syn cookies
|
$swift_tuning = {
|
||||||
net.ipv4.tcp_syncookies = 0
|
'net.ipv4.tcp_tw_recycle' => { value => 1 },
|
||||||
|
'net.ipv4.tcp_tw_reuse' => { value => 1 },
|
||||||
# double amount of allowed conntrack
|
'net.ipv4.tcp_syncookies' => { value => 0 },
|
||||||
net.ipv4.netfilter.ip_conntrack_max = 524288
|
'net.ipv4.netfilter.ip_conntrack_max' => { value => 524288 },
|
||||||
net.ipv4.netfilter.ip_conntrack_tcp_timeout_time_wait = 2
|
'net.ipv4.netfilter.ip_conntrack_tcp_timeout_time_wait' => { value => 2 },
|
||||||
net.ipv4.netfilter.ip_conntrack_tcp_timeout_close_wait = 2
|
'net.ipv4.netfilter.ip_conntrack_tcp_timeout_close_wait' => { value => 2 },
|
||||||
|
'net.ipv4.ip_local_port_range' => { value => "1024\t65000" },
|
||||||
net.ipv4.ip_local_port_range = 1024 65000
|
'net.core.netdev_max_backlog' => { value => 300000 },
|
||||||
|
'net.ipv4.tcp_sack' => { value => 0 },
|
||||||
## 10Gb Tuning
|
|
||||||
net.core.netdev_max_backlog = 300000
|
|
||||||
net.ipv4.tcp_sack = 0
|
|
||||||
|
|
||||||
",
|
|
||||||
owner => 'root',
|
|
||||||
group => 'root',
|
|
||||||
}
|
}
|
||||||
|
|
||||||
exec{'update-etc-modules-with-ip_conntrack':
|
$require = {
|
||||||
command => '/bin/echo ip_conntrack >> /etc/modules',
|
require => Kmod::Load['ip_conntrack']
|
||||||
unless => '/bin/grep -qFx "ip_conntrack" /etc/modules',
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Load sysctl and module only the first time
|
create_resources(sysctl::value,$swift_tuning,$require)
|
||||||
exec{'load-ip_conntrack':
|
|
||||||
command => '/sbin/modprobe ip_conntrack',
|
|
||||||
unless => '/bin/grep -qFx "ip_conntrack" /etc/modules',
|
|
||||||
require => File['/etc/sysctl.d/swift-tuning.conf']
|
|
||||||
}
|
|
||||||
exec{'reload-sysctl-swift-tunning':
|
|
||||||
command => '/sbin/sysctl -p /etc/sysctl.d/swift-tuning.conf',
|
|
||||||
unless => '/bin/grep -qFx "ip_conntrack" /etc/modules',
|
|
||||||
require => File['/etc/sysctl.d/swift-tuning.conf']
|
|
||||||
}
|
|
||||||
|
|
||||||
file{'/var/log/swift':
|
file { '/var/log/swift':
|
||||||
ensure => directory,
|
ensure => directory,
|
||||||
owner => swift,
|
owner => swift,
|
||||||
group => swift,
|
group => swift,
|
||||||
}
|
}
|
||||||
|
|
||||||
file{'/etc/logrotate.d/swift':
|
logrotate::rule { 'swift':
|
||||||
content => "
|
path => '/var/log/swift/*.log',
|
||||||
/var/log/swift/proxy.log /var/log/swift/proxy.error.log /var/log/swift/account-server.log /var/log/swift/account-server.error.log /var/log/swift/container-server.log /var/log/swift/container-server.error.log /var/log/swift/object-server.log /var/log/swift/object-server.error.log
|
rotate => 7,
|
||||||
{
|
rotate_every => 'day',
|
||||||
rotate 7
|
missingok => true,
|
||||||
daily
|
ifempty => false,
|
||||||
missingok
|
compress => true,
|
||||||
notifempty
|
delaycompress => true,
|
||||||
delaycompress
|
|
||||||
compress
|
|
||||||
postrotate
|
|
||||||
endscript
|
|
||||||
}
|
|
||||||
"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user