summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorLoïc Hoguin <essen@ninenines.eu>2018-05-21 13:26:01 +0200
committerLoïc Hoguin <essen@ninenines.eu>2018-05-29 11:49:09 +0200
commitced1c03338dbb0e19a7ceccd1874432d4235e15f (patch)
tree27f09488a3fee795f5278e57801fa500f5816065 /scripts
parentd0423f958599cba5148864997aa8446c873dad00 (diff)
downloadrabbitmq-server-git-ced1c03338dbb0e19a7ceccd1874432d4235e15f.tar.gz
Use better default memory allocators
We have settled on the following configuration for memory allocators after testing many different combinations: +MBas ageffcbf +MHas ageffcbf +MBlmbcs 512 +MHlmbcs 512 +MMmcs 30 They reduce the memory usage and help RabbitMQ reclaim memory, at the cost of a slight decrease in performance due to an increased number of memory operations. We need to start Erlang with these values in order to figure out whether they are supported. The allocator strategies we recommend were introduced in Erlang/OTP 20.2.3. The values can be overriden using RABBITMQ_SERVER_ERL_ARGS. cc @gerhard
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/rabbitmq-server20
-rw-r--r--scripts/rabbitmq-server.bat22
-rw-r--r--scripts/rabbitmq-service.bat22
3 files changed, 64 insertions, 0 deletions
diff --git a/scripts/rabbitmq-server b/scripts/rabbitmq-server
index 27948ea6b7..f8b868c039 100755
--- a/scripts/rabbitmq-server
+++ b/scripts/rabbitmq-server
@@ -120,6 +120,25 @@ if [ ! -f "${RABBITMQ_SCHEMA_DIR}/rabbit.schema" ]; then
cp "${RABBITMQ_HOME}/priv/schema/rabbit.schema" "${RABBITMQ_SCHEMA_DIR}"
fi
+# The default allocation strategy RabbitMQ is using was introduced
+# in Erlang/OTP 20.2.3. Earlier Erlang versions fail to start with
+# this configuration. We therefore need to ensure that erl accepts
+# these values before we can use them.
+#
+# The defaults are meant to reduce RabbitMQ's memory usage and help
+# it reclaim memory at the cost of a slight decrease in performance
+# (due to an increase in memory operations). These defaults can be
+# overriden using the RABBITMQ_SERVER_ERL_ARGS variable.
+RABBITMQ_DEFAULT_ALLOC_ARGS="+MBas ageffcbf +MHas ageffcbf +MBlmbcs 512 +MHlmbcs 512 +MMmcs 30"
+
+${ERL_DIR}erl ${RABBITMQ_DEFAULT_ALLOC_ARGS} \
+ -boot "${CLEAN_BOOT_FILE}" \
+ -noinput -eval 'halt(0)' 2>/dev/null
+
+if [ $? != 0 ] ; then
+ RABBITMQ_DEFAULT_ALLOC_ARGS=
+fi
+
set -e
RABBITMQ_CONFIG_FILE_NOEX="${RABBITMQ_CONFIG_FILE%.*}"
@@ -213,6 +232,7 @@ start_rabbitmq_server() {
${RABBITMQ_CONFIG_ARG} \
+W w \
+A ${RABBITMQ_IO_THREAD_POOL_SIZE} \
+ ${RABBITMQ_DEFAULT_ALLOC_ARGS} \
${RABBITMQ_SERVER_ERL_ARGS} \
+K true \
-kernel inet_default_connect_options "[{nodelay,true}]" \
diff --git a/scripts/rabbitmq-server.bat b/scripts/rabbitmq-server.bat
index 7f3751f298..f6a61842fd 100644
--- a/scripts/rabbitmq-server.bat
+++ b/scripts/rabbitmq-server.bat
@@ -72,6 +72,27 @@ if ERRORLEVEL 2 (
set RABBITMQ_DIST_ARG=-kernel inet_dist_listen_min !RABBITMQ_DIST_PORT! -kernel inet_dist_listen_max !RABBITMQ_DIST_PORT!
)
+rem The default allocation strategy RabbitMQ is using was introduced
+rem in Erlang/OTP 20.2.3. Earlier Erlang versions fail to start with
+rem this configuration. We therefore need to ensure that erl accepts
+rem these values before we can use them.
+rem
+rem The defaults are meant to reduce RabbitMQ's memory usage and help
+rem it reclaim memory at the cost of a slight decrease in performance
+rem (due to an increase in memory operations). These defaults can be
+rem overriden using the RABBITMQ_SERVER_ERL_ARGS variable.
+
+set RABBITMQ_DEFAULT_ALLOC_ARGS=+MBas ageffcbf +MHas ageffcbf +MBlmbcs 512 +MHlmbcs 512 +MMmcs 30
+
+"!ERLANG_HOME!\bin\erl.exe" ^
+ !RABBITMQ_DEFAULT_ALLOC_ARGS! ^
+ -boot !CLEAN_BOOT_FILE! ^
+ -noinput -eval "halt(0)"
+
+if ERRORLEVEL 1 (
+ set RABBITMQ_DEFAULT_ALLOC_ARGS=
+)
+
if not exist "!RABBITMQ_SCHEMA_DIR!" (
mkdir "!RABBITMQ_SCHEMA_DIR!"
)
@@ -173,6 +194,7 @@ if "!ENV_OK!"=="false" (
!RABBITMQ_NAME_TYPE! !RABBITMQ_NODENAME! ^
+W w ^
+A "!RABBITMQ_IO_THREAD_POOL_SIZE!" ^
+!RABBITMQ_DEFAULT_ALLOC_ARGS! ^
!RABBITMQ_SERVER_ERL_ARGS! ^
!RABBITMQ_LISTEN_ARG! ^
-kernel inet_default_connect_options "[{nodelay, true}]" ^
diff --git a/scripts/rabbitmq-service.bat b/scripts/rabbitmq-service.bat
index cef481c252..0a93462359 100644
--- a/scripts/rabbitmq-service.bat
+++ b/scripts/rabbitmq-service.bat
@@ -160,6 +160,27 @@ if ERRORLEVEL 3 (
set RABBITMQ_DIST_ARG=-kernel inet_dist_listen_min !RABBITMQ_DIST_PORT! -kernel inet_dist_listen_max !RABBITMQ_DIST_PORT!
)
+rem The default allocation strategy RabbitMQ is using was introduced
+rem in Erlang/OTP 20.2.3. Earlier Erlang versions fail to start with
+rem this configuration. We therefore need to ensure that erl accepts
+rem these values before we can use them.
+rem
+rem The defaults are meant to reduce RabbitMQ's memory usage and help
+rem it reclaim memory at the cost of a slight decrease in performance
+rem (due to an increase in memory operations). These defaults can be
+rem overriden using the RABBITMQ_SERVER_ERL_ARGS variable.
+
+set RABBITMQ_DEFAULT_ALLOC_ARGS=+MBas ageffcbf +MHas ageffcbf +MBlmbcs 512 +MHlmbcs 512 +MMmcs 30
+
+"!ERLANG_HOME!\bin\erl.exe" ^
+ !RABBITMQ_DEFAULT_ALLOC_ARGS! ^
+ -boot !CLEAN_BOOT_FILE! ^
+ -noinput -eval "halt(0)"
+
+if ERRORLEVEL 1 (
+ set RABBITMQ_DEFAULT_ALLOC_ARGS=
+)
+
if not exist "!RABBITMQ_SCHEMA_DIR!" (
mkdir "!RABBITMQ_SCHEMA_DIR!"
)
@@ -254,6 +275,7 @@ set ERLANG_SERVICE_ARGUMENTS= ^
!RABBITMQ_CONFIG_ARG! ^
+W w ^
+A "!RABBITMQ_IO_THREAD_POOL_SIZE!" ^
+!RABBITMQ_DEFAULT_ALLOC_ARGS! ^
!RABBITMQ_SERVER_ERL_ARGS! ^
!RABBITMQ_LISTEN_ARG! ^
-kernel inet_default_connect_options "[{nodelay,true}]" ^