profiles: added SAP profile
Also added support for the sysctl tunings taken from the environment and conditional tunings (i.e. not to change the sysctl settings if the current value is greater than the new value). To use the environment variable SEM: kernel.sem = $SEM To set the kernel.shmall only if the current value is less than the 1000000: kernel.shmall = >$1000000 Both can be combined, e.g.: kernel.shmall = >$SHMALL Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
This commit is contained in:
parent
43eb6315c1
commit
438c1335da
3 changed files with 48 additions and 9 deletions
|
|
@ -101,6 +101,10 @@ Profile optimized for virtual guests based on enterprise-storage profile. It add
|
|||
.BI "virtual-host"
|
||||
Profile optimized for virtual hosts based on enterprise-storage profile. It additionally decreases virtual memory swapiness and enables more aggresive writeback of dirty pages.
|
||||
|
||||
.TP
|
||||
.BI "sap"
|
||||
Profile optimized for the best performance of SAP software. It is based on enterprise-storage profile. It additionally tunes sysctl settings regarding shared memory, semaphores and maximum number of memory map areas a process may have.
|
||||
|
||||
.SH "FILES"
|
||||
.nf
|
||||
/etc/tune-profiles/*
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ service is enabled and started, it will use the configuration options from
|
|||
|
||||
SYSCTL="/etc/sysctl.ktune"
|
||||
USE_KTUNE_D="yes"
|
||||
SYSCTL_PRE="/etc/sysctl.d/* /etc/sysctl.conf"
|
||||
SYSCTL_POST="/etc/sysctl.d/* /etc/sysctl.conf"
|
||||
ELEVATOR="deadline"
|
||||
ELEVATOR_TUNE_DEVS="/sys/block/{sd,cciss}*/queue/scheduler"
|
||||
|
|
@ -60,7 +61,12 @@ profiles from the /etc/ktune.d directory. A profile has to have the extension
|
|||
.conf to be used. If there is an additional file with the same name, but the
|
||||
extension .sh it will be used as a profile script.
|
||||
|
||||
SYSCTL_POST references the system wide sysctl file for customer settings.
|
||||
SYSCTL_PRE references the system wide sysctl file for customer settings that
|
||||
is loaded before the ktune tunings. The tunings from this file may be
|
||||
overridden by ktune settings. Most profile don't use this option.
|
||||
|
||||
SYSCTL_POST references the system wide sysctl file for customer settings that
|
||||
is loaded after the ktune tunings. This may override the ktune settings.
|
||||
|
||||
ELEVATOR is the I/O scheduler, ktune will set for ELEVATOR_TUNE_DEVS. If you
|
||||
want to disable the setting of the I/O scheduler, just comment out the ELEVATOR
|
||||
|
|
|
|||
|
|
@ -67,9 +67,15 @@ $(LANG=C /bin/ls -1 /etc/ktune.d/*.conf 2>/dev/null)
|
|||
EOF
|
||||
fi
|
||||
|
||||
function is_int
|
||||
{
|
||||
[ ! -z "${1##*[^0-9]*}" ]
|
||||
}
|
||||
|
||||
load_file() {
|
||||
local file=$1
|
||||
local save=$2
|
||||
local curr_value
|
||||
|
||||
ret_s=0
|
||||
errors=
|
||||
|
|
@ -81,19 +87,34 @@ load_file() {
|
|||
key=$(echo $line | awk '{ match($0,"[ \t]*=[ \t]*") && $0=substr($0,1,RSTART-1); print $0}')
|
||||
value=$(echo $line | awk '/=/ { match($0,"[ \t]*=[ \t]*"); $0=substr($0,RSTART+RLENGTH); print $0}')
|
||||
|
||||
curr_value=""
|
||||
if [ "${value:0:1}" = '>' ]; then
|
||||
value=${value:1}
|
||||
curr_value=$($SYSCTL_GET -n "$key")
|
||||
fi
|
||||
|
||||
if [ "${value:0:1}" = '$' ]; then
|
||||
value=${value:1}
|
||||
value=${!value}
|
||||
fi
|
||||
|
||||
is_int "$curr_value" && is_int "$value" && [ "$value" -lt "$curr_value" ] && value="$curr_value"
|
||||
|
||||
[ $save -ne 0 ] && save_value=$($SYSCTL_GET "$key")
|
||||
|
||||
setting=$key
|
||||
[ -n "$value" ] && setting+="=${value}"
|
||||
if [ "$value" ]; then
|
||||
[ -n "$value" ] && setting+="=${value}"
|
||||
|
||||
error="$($SYSCTL_SET "${setting}" 2>&1)"
|
||||
ret=$?
|
||||
if [ $save -ne 0 -a $ret -eq 0 ] && ! grep -q "^${key} =" $SAVE_FILE 2>/dev/null; then
|
||||
echo "$save_value" >> "$SAVE_FILE"
|
||||
error="$($SYSCTL_SET "${setting}" 2>&1)"
|
||||
ret=$?
|
||||
if [ $save -ne 0 -a $ret -eq 0 ] && ! grep -q "^${key} =" $SAVE_FILE 2>/dev/null; then
|
||||
echo "$save_value" >> "$SAVE_FILE"
|
||||
fi
|
||||
[ -n "$error" ] && errors+="${error}\n"
|
||||
|
||||
let ret_s+=$ret
|
||||
fi
|
||||
[ -n "$error" ] && errors+="${error}\n"
|
||||
|
||||
let ret_s+=$ret
|
||||
done < "$file"
|
||||
|
||||
if [ $ret_s -eq 0 ]; then
|
||||
|
|
@ -126,6 +147,14 @@ load_sysctl() {
|
|||
/bin/rm -f "$SAVE_FILE"
|
||||
|
||||
if [ ${#KTUNE_FILES[@]} -gt 0 ]; then
|
||||
# Apply general sysctl settings beforehand
|
||||
for f in $SYSCTL_PRE; do
|
||||
if [ -r "$f" ]; then
|
||||
echo $"Applying sysctl settings from $f"
|
||||
sysctl -e -p "$f" >/dev/null 2>&1
|
||||
fi
|
||||
done
|
||||
|
||||
echo $"Applying ktune sysctl settings:"
|
||||
|
||||
# Apply ktune files.
|
||||
|
|
|
|||
Loading…
Reference in a new issue