1
0
Fork 0

ktune: update throughput-performance profile for rhel6

Per discussion with the perf team:

- Set performance cpuspeed governor
- Set deadline io scheduler
- Set kernel.sched_min_granularity_ns = 10000000
- Set kernel.sched_wakeup_granularity_ns = 15000000
- Set vm.dirty_ratio = 40

Signed-off-by: Jarod Wilson <jarod@redhat.com>
This commit is contained in:
Jarod Wilson 2010-07-08 17:38:32 -04:00
parent 88ed6a3138
commit d88e88579f
3 changed files with 127 additions and 46 deletions

View file

@ -0,0 +1,113 @@
#!/bin/sh
VAR_SUBSYS_KTUNE="/var/lock/subsys/ktune"
CPUSPEED_SAVE_FILE="/var/run/ktune-cpuspeed.save"
CPUSPEED_ORIG_GOV="var/run/ktune-cpuspeed-governor.save"
CPUSPEED_CFG="/etc/sysconfig/cpuspeed"
CPUSPEED_INIT="/etc/init.d/cpuspeed"
CPUS="/sys/devices/system/cpu*/cpufreq"
THP_ENABLE="/sys/kernel/mm/redhat_transparent_hugepage/enabled"
THP_SAVE="/var/run/ktune-thp.save"
start() {
# Save currently enabled governor and/or cpuspeed config
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor > $CPUSPEED_ORIG_GOV
if [ ! -e $CPUSPEED_SAVE_FILE -a -e $CPUSPEED_CFG ]; then
cp -p $CPUSPEED_CFG $CPUSPEED_SAVE_FILE
sed -e 's/^GOVERNOR=.*/GOVERNOR=performance/g' $CPUSPEED_SAVE_FILE > $CPUSPEED_CFG
fi
# Enable performance governor (best for maximum i/o throughput in most cases)
if [ -e $CPUSPEED_INIT ]; then
/sbin/service cpuspeed restart > /dev/null 2>&1
else
for cpu in $CPUS; do
echo performance > $cpu/scaling_governor
done
fi
# Make sure transparent hugepages are enabled
cut -f2 -d'[' $THP_ENABLE | cut -f1 -d']' > $THP_SAVE
(echo always > $THP_ENABLE) > /dev/null 2>&1
return 0
}
stop() {
# Restore previous cpuspeed config
if [ -e $CPUSPEED_SAVE_FILE ]; then
cp -fp $CPUSPEED_SAVE_FILE $CPUSPEED_CFG
rm -f $CPUSPEED_SAVE_FILE
fi
# Re-enable previous governor
if [ -e $CPUSPEED_INIT ]; then
/sbin/service cpuspeed restart > /dev/null 2>&1
elif [ -e $CPUSPEED_ORIG_GOV ]; then
for cpu in $CPUS; do
echo $(cat $CPUSPEED_ORIG_GOV) > $cpu/scaling_governor
done
else
for cpu in $CPUS; do
echo userspace > $cpu/scaling_governor
cat $cpu/cpuinfo_max_freq > $cpu/scaling_setspeed
done
fi
if [ -e $CPUSPEED_ORIG_GOV ]; then
rm -f $CPUSPEED_ORIG_GOV
fi
# Restore transparent hugepages setting
if [ -e $THP_SAVE ]; then
(echo $(cat $THP_SAVE) > $THP_ENABLE) > /dev/null 2>&1
rm -f $THP_SAVE
fi
return 0
}
reload() {
start
}
status() {
return 0
}
case "$1" in
start)
[ -f "$VAR_SUBSYS_KTUNE" ] && exit 0
start
RETVAL=$?
;;
stop)
[ -f "$VAR_SUBSYS_KTUNE" ] || exit 0
stop
RETVAL=$?
;;
reload)
[ -f "$VAR_SUBSYS_KTUNE" ] && reload
RETVAL=$?
;;
restart|force-reload)
[ -f "$VAR_SUBSYS_KTUNE" ] && stop
start
RETVAL=$?
;;
condrestart|try-restart)
[ -f "$VAR_SUBSYS_KTUNE" ] || exit 0
stop
start
RETVAL=$?
;;
status)
status
RETVAL=$?
;;
*)
echo $"Usage: $0 {start|stop|restart|condrestart|status}"
RETVAL=2
;;
esac

View file

@ -2,7 +2,7 @@
# This is the ktune sysctl file. You can comment this out to prevent ktune
# from applying its sysctl settings.
#SYSCTL="/etc/sysctl.ktune"
SYSCTL="/etc/sysctl.ktune"
# Use *.conf files in the ktune configuration directory /etc/ktune.d.
# Value: yes|no, default: yes

View file

@ -1,51 +1,19 @@
# ktune sysctl settings for EL 5 servers
# ktune sysctl settings for rhel6 servers, maximizing i/o throughput
#
# Minimal preemption granularity for CPU-bound tasks:
# (default: 1 msec# (1 + ilog(ncpus)), units: nanoseconds)
kernel.sched_min_granularity_ns = 10000000
# 256 KB default performs well experimentally, and is often recommended by ISVs.
net.core.rmem_default = 262144
net.core.wmem_default = 262144
# When opening a high-bandwidth connection while the receiving end is under
# memory pressure, disk I/O may be necessary to free memory for the socket,
# making disk latency the effective latency for the bandwidth-delay product
# initially. For 10 Gb ethernet and SCSI, the BDP is about 5 MB. Allow 8 MB
# to account for overhead, to ensure that new sockets can saturate the medium
# quickly.
net.core.rmem_max = 8388608
net.core.wmem_max = 8388608
# Allow a deep backlog for 10 Gb and bonded Gb ethernet connections
net.core.netdev_max_backlog = 10000
# Always have one page available, plus an extra for overhead, to ensure TCP NFS
# pageout doesn't stall under memory pressure. Default to max unscaled window,
# plus overhead for rmem, since most LAN sockets won't need to scale.
net.ipv4.tcp_rmem = 8192 87380 8388608
net.ipv4.tcp_wmem = 8192 65536 8388608
# Always have enough memory available on a UDP socket for an 8k NFS request,
# plus overhead, to prevent NFS stalling under memory pressure. 16k is still
# low enough that memory fragmentation is unlikely to cause problems.
net.ipv4.udp_rmem_min = 16384
net.ipv4.udp_wmem_min = 16384
# Ensure there's enough memory to actually allocate those massive buffers to a
# socket.
net.ipv4.tcp_mem = 8388608 12582912 16777216
net.ipv4.udp_mem = 8388608 12582912 16777216
# Filesystem I/O is usually much more efficient than swapping, so try to keep
# swapping low. It's usually safe to go even lower than this on systems with
# server-grade storage.
vm.swappiness = 30
# SCHED_OTHER wake-up granularity.
# (default: 1 msec# (1 + ilog(ncpus)), units: nanoseconds)
#
# This option delays the preemption effects of decoupled workloads
# and reduces their over-scheduling. Synchronous workloads will still
# have immediate wakeup/sleep latencies.
kernel.sched_wakeup_granularity_ns = 15000000
# If a workload mostly uses anonymous memory and it hits this limit, the entire
# working set is buffered for I/O, and any more write buffering would require
# swapping, so it's time to throttle writes until I/O can catch up. Workloads
# that mostly use file mappings may be able to use even higher values.
vm.dirty_ratio = 50
# Ensure there's always some easily-dropped pagecache if the system is under
# memory pressure from cached files, since it's much faster to page back in than
# swap.
# Doesn't exist for 2.6.30++ anymore
# vm.pagecache = 90
vm.dirty_ratio = 40