Skip to content

Instantly share code, notes, and snippets.

@mheffner
Created February 10, 2016 18:06
cassandra upstart config
start on runlevel [23]
respawn
limit nofile 1000000 1000000
limit memlock unlimited unlimited
script
# When running a restart, sleeping helps it succeed
sleep 3
# Use either this, or -XX:+UseNUMA below
# numactl --interleave
# Ensure that the queing behavior on our cassandra block device is
# tuned for ssd
for disk in $(blockdev --report | grep -v xvda | grep '/dev' | cut -d/ -f3) ; do
echo 1 > /sys/block/$disk/queue/nomerges # SSD only! 0 on HDD
echo 8 > /sys/block/$disk/queue/read_ahead_kb
done
# Use the TSC as the clock source instead of xen
echo "tsc" > /sys/devices/system/clocksource/clocksource0/current_clocksource
# Leave a CPU free for the OS
MAX_CPU=$(grep 'processor' /proc/cpuinfo | tail -1 | cut -d':' -f2 | sed 's/^ //')
START_TIME=$(date +%s)
# This is based on what the datastax community cassandra 2.2.4 looks like when it's started:
chrt --batch 0 \
taskset -c 1-${MAX_CPU} \
sudo -u cassandra \
java \
-ea \
-javaagent:/opt/apache-cassandra-2.2.5-SNAPSHOT/lib/jamm-0.3.0.jar \
-XX:+UseG1GC \
-XX:+ParallelRefProcEnabled \
-XX:ParallelGCThreads=6 \
-XX:ConcGCThreads=6 \
-XX:MaxGCPauseMillis=500 \
-XX:G1RSetUpdatingPauseTimePercent=5 \
-XX:InitiatingHeapOccupancyPercent=25 \
-XX:G1HeapRegionSize=32m \
-XX:+AlwaysPreTouch \
-XX:-UseBiasedLocking \
-XX:+UseTLAB -XX:+ResizeTLAB \
-XX:+UseNUMA \
-XX:+UseThreadPriorities \
-XX:ThreadPriorityPolicy=42 \
-Xms8G \
-Xmx8G \
-XX:+HeapDumpOnOutOfMemoryError \
-Xss256k \
-XX:StringTableSize=1000003 \
-XX:SurvivorRatio=8 \
-XX:MaxTenuringThreshold=1 \
-XX:+PerfDisableSharedMem \
-XX:+UseCondCardMark \
-XX:+PrintGCDetails \
-XX:+PrintGCDateStamps \
-XX:+PrintHeapAtGC \
-XX:+PrintTenuringDistribution \
-XX:+PrintGCApplicationStoppedTime \
-XX:+PrintPromotionFailure \
-XX:PrintFLSStatistics=1 \
-Xloggc:/var/log/cassandra/gc.log \
-XX:+UseGCLogFileRotation \
-XX:NumberOfGCLogFiles=10 \
-XX:GCLogFileSize=10M \
-Djava.net.preferIPv4Stack=true \
-Dcassandra.jmx.local.port=7199 \
-Dcom.sun.management.jmxremote.port=7199 \
-Dcom.sun.management.jmxremote.rmi.port=7199 \
-Dcom.sun.management.jmxremote.ssl=false \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.password.file=/dev/null \
-XX:+DisableExplicitGC \
-Djava.library.path=/opt/apache-cassandra-2.2.5-SNAPSHOT/lib/sigar-bin \
-Dlogback.configurationFile=logback.xml \
-Dcassandra.libjemalloc=/usr/lib/x86_64-linux-gnu/libjemalloc.so.1 \
-Dcassandra.logdir=/var/log/cassandra \
-Dcassandra.storagedir= \
-Dcassandra.metricsReporterConfigFile=metrics.yaml \
-cp /etc/cassandra:/opt/apache-cassandra-2.2.5-SNAPSHOT/lib/*:/opt/apache-cassandra-2.2.5-SNAPSHOT/*: \
-XX:HeapDumpPath=/var/lib/cassandra/ \
-XX:ErrorFile=/var/lib/cassandra/hs_err_$START_TIME.log \
org.apache.cassandra.service.CassandraDaemon
end script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment