Last active
August 29, 2015 14:26
-
-
Save tobert/97c52f80fdff2ba79ee9 to your computer and use it in GitHub Desktop.
Pin Apache Cassandra compaction threads to a core
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
#!/bin/bash | |
# A quick & dirty script to pin compaction threads to a core without | |
# any consideration for HT or what kind of compaction any given thread | |
# is doing. | |
# atobey@datastax.com 2015-08-02 | |
# match all processes with nice value 4, which is hard-coded in Cassandra | |
pids=$(ps -eLo nice,tid,args |awk '/^ *4 .*java/{print $2}') | |
ncores=$(grep ^processor /proc/cpuinfo |wc -l) | |
offset=1 | |
for pid in $pids | |
do | |
core=$(($ncores - $offset)) | |
offset=$(($offset + 1)) | |
if [ $offset -gt $ncores ] ; then | |
offset=1 | |
fi | |
taskset -pc $core $pid | |
ionice --class 3 --pid $pid | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment