Skip to content

Commit

Permalink
Make heap size configurable through env variable (#1173)
Browse files Browse the repository at this point in the history
  • Loading branch information
adejanovski authored Apr 29, 2022
1 parent 4624485 commit 209f288
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/packaging/bin/cassandra-reaper
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,17 @@ if [ -z $JAVA ] ; then
exit 1;
fi

if [ -z "$REAPER_HEAP_SIZE" ]; then
REAPER_HEAP_SIZE="2G"
fi


JVM_OPTS=(
# it is safe and performant to disable assertions in production
# environments (ie replace `-ea` with `-da`)
-ea
-Xms2G
-Xmx2G
-Xms${REAPER_HEAP_SIZE}
-Xmx${REAPER_HEAP_SIZE}
${JVM_OPTS[@]}
# Prefer binding to IPv4 network intefaces (when net.ipv6.bindv6only=1). See
# http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6342561 (short version:
Expand Down
5 changes: 5 additions & 0 deletions src/server/src/main/docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ function wait_for {

if [ "$1" = 'cassandra-reaper' ]; then

if [ -z "$REAPER_HEAP_SIZE" ]; then
REAPER_HEAP_SIZE="1G"
fi
# get around `/usr/local/bin/configure-persistence.sh: line 65: can't create /etc/cassandra-reaper/cassandra-reaper.yml: Interrupted system call` unknown error
touch /etc/cassandra-reaper/cassandra-reaper.yml

Expand All @@ -42,6 +45,8 @@ if [ "$1" = 'cassandra-reaper' ]; then
/usr/local/bin/configure-jmx-credentials.sh
exec java \
${JAVA_OPTS} \
-Xms${REAPER_HEAP_SIZE} \
-Xmx${REAPER_HEAP_SIZE} \
-cp "/usr/local/lib/*" io.cassandrareaper.ReaperApplication server \
/etc/cassandra-reaper/cassandra-reaper.yml
fi
Expand Down

0 comments on commit 209f288

Please sign in to comment.