Files
scylladb/dist/common/scripts/scylla_sysconfig_setup
Takuya ASADA 533dc0485d dist/common/scripts/scylla_sysconfig_setup: sync cpuset parameters with rps_cpus settings when posix_net_conf.sh is enabled and NIC is single queue
On posix_net_conf.sh's single queue NIC mode (which means RPS enabled mode), we are excluded cpu0 and it's sibling from network stack processing cpus, and assigned NIC IRQ to cpu0.
So always network stack is not working on cpu0 and it's sibling, to get better performance we need to exclude these cpus from scylla too.
To do this, we need to get RPS cpu mask from posix_net_conf.sh, pass it to scylla_cpuset_setup to construct /etc/scylla.d/cpuset.conf when scylla_setup executed.

Signed-off-by: Takuya ASADA <syuu@scylladb.com>
Message-Id: <1472544875-2033-2-git-send-email-syuu@scylladb.com>
2016-08-30 16:51:16 +03:00

110 lines
3.1 KiB
Bash
Executable File

#!/bin/bash -e
#
# Copyright (C) 2015 ScyllaDB
print_usage() {
echo "scylla-sysconfig-setup --nic eth0 --mode posix --nr-hugepages 64 --user scylla --group scylla --homedir /var/lib/scylla --confdir /etc/scylla --setup-nic"
echo " --nic specify NIC"
echo " --mode network mode (posix, dpdk)"
echo " --nr-hugepages number of hugepages"
echo " --user user (dpdk requires root)"
echo " --group group (dpdk requires root)"
echo " --homedir scylla home directory"
echo " --confdir scylla config directory"
echo " --setup-nic setup NIC's interrupts, RPS, XPS"
echo " --ami AMI instance mode"
exit 1
}
. /etc/os-release
if [ "$ID" = "ubuntu" ] || [ "$ID" = "debian" ]; then
SYSCONFIG=/etc/default
else
SYSCONFIG=/etc/sysconfig
fi
. $SYSCONFIG/scylla-server
if [ $# -eq 0 ]; then
print_usage
fi
while [ $# -gt 0 ]; do
case "$1" in
"--nic")
NIC="$2"
shift 2
;;
"--mode")
NETWORK_MODE="$2"
shift 2
;;
"--nr-hugepages")
NR_HUGEPAGES="$2"
shift 2
;;
"--user")
USER="$2"
shift 2
;;
"--group")
GROUP="$2"
shift 2
;;
"--homedir")
SCYLLA_HOME="$2"
shift 2
;;
"--confdir")
SCYLLA_CONF="$2"
shift 2
;;
"--setup-nic")
SET_NIC=yes
shift 1
;;
"--ami")
AMI=yes
shift 1
;;
*)
print_usage
;;
esac
done
echo Setting parameters on $SYSCONFIG/scylla-server
if [ $SET_NIC = "yes" ]; then
RPS_CPUS=$(/usr/lib/scylla/posix_net_conf.sh --cpu-mask $NIC)
RPS_CPUS=${RPS_CPUS//0x}
RPS_CPUS=${RPS_CPUS//,}
if [ "$RPS_CPUS" != "" ]; then
BITS=$(echo "obase=2;ibase=16;${RPS_CPUS~~}"|bc|rev)
for ((i=0; i < ${#BITS}; i++)); do
if [ ${BITS:$i:1} -eq 1 ]; then
CPUSET="$CPUSET$i"
if [ $i -lt $((${#BITS} - 1)) ]; then
CPUSET="$CPUSET,"
fi
fi
done
/usr/lib/scylla/scylla_cpuset_setup --cpuset $CPUSET
fi
fi
ETHDRV=`/usr/lib/scylla/dpdk_nic_bind.py --status | grep if=$NIC | sed -e "s/^.*drv=//" -e "s/ .*$//"`
ETHPCIID=`/usr/lib/scylla/dpdk_nic_bind.py --status | grep if=$NIC | awk '{print $1}'`
sed -e s#^NETWORK_MODE=.*#NETWORK_MODE=$NETWORK_MODE# \
-e s#^IFNAME=.*#IFNAME=$NIC# \
-e s#^ETHDRV=.*#ETHDRV=$ETHDRV# \
-e s#^ETHPCIID=.*#ETHPCIID=$ETHPCIID# \
-e s#^NR_HUGEPAGES=.*#NR_HUGEPAGES=$NR_HUGEPAGES# \
-e s#^USER=.*#USER=$USER# \
-e s#^GROUP=.*#GROUP=$GROUP# \
-e s#^SCYLLA_HOME=.*#SCYLLA_HOME=$SCYLLA_HOME# \
-e s#^SCYLLA_CONF=.*#SCYLLA_CONF=$SCYLLA_CONF# \
-e s#^SET_NIC=.*#SET_NIC=$SET_NIC# \
-e "s#^SCYLLA_ARGS=.*#SCYLLA_ARGS=\"$SCYLLA_ARGS\"#" \
-e s#^AMI=.*#AMI=$AMI# \
$SYSCONFIG/scylla-server > /tmp/scylla-server
mv /tmp/scylla-server $SYSCONFIG/scylla-server