Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make heap size configurable through env variable #1173

Merged
merged 2 commits into from
Apr 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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