chore: improve emqx boot script's compatibility check

Prior to this change, the command used to check installation
and os compatibility is done by starting a 'erl' process using
default flags. it might be unnecessarily expensive in large
VM instances.
In this change, we have added small enough +S +P and +Q number to
make lower the cost.
This commit is contained in:
zmstone 2024-06-03 11:04:38 +02:00
parent ec7ec7261e
commit 8276ae54a1
2 changed files with 11 additions and 2 deletions

View File

@ -337,6 +337,9 @@ compatiblity_info() {
# set crash-dump bytes to zero to ensure no crash dump is generated when erl crashes # set crash-dump bytes to zero to ensure no crash dump is generated when erl crashes
env ERL_CRASH_DUMP_BYTES=0 "$BINDIR/$PROGNAME" \ env ERL_CRASH_DUMP_BYTES=0 "$BINDIR/$PROGNAME" \
-noshell \ -noshell \
+S 2 \
+P 65536 \
+Q 65536 \
-boot "$REL_DIR/start_clean" \ -boot "$REL_DIR/start_clean" \
-boot_var RELEASE_LIB "$ERTS_LIB_DIR/lib" \ -boot_var RELEASE_LIB "$ERTS_LIB_DIR/lib" \
-eval "$COMPATIBILITY_CHECK" -eval "$COMPATIBILITY_CHECK"
@ -408,6 +411,7 @@ remsh() {
-setcookie "$COOKIE" \ -setcookie "$COOKIE" \
-hidden \ -hidden \
-kernel net_ticktime "$TICKTIME" \ -kernel net_ticktime "$TICKTIME" \
+P 65536 \
+Q 65536 \ +Q 65536 \
+S 2 \ +S 2 \
$EPMD_ARGS $EPMD_ARGS
@ -420,6 +424,7 @@ remsh() {
--erl "-kernel net_ticktime $TICKTIME" \ --erl "-kernel net_ticktime $TICKTIME" \
--erl "$EPMD_ARGS" \ --erl "$EPMD_ARGS" \
--erl "$NAME_TYPE $id" \ --erl "$NAME_TYPE $id" \
--erl "+P 65536" \
--erl "+Q 65536" \ --erl "+Q 65536" \
--erl "+S 2" \ --erl "+S 2" \
--boot "$REL_DIR/start_clean" --boot "$REL_DIR/start_clean"
@ -1307,7 +1312,11 @@ case "${COMMAND}" in
--boot "$REL_DIR/start_clean" \ --boot "$REL_DIR/start_clean" \
--boot-var RELEASE_LIB "$ERTS_LIB_DIR" \ --boot-var RELEASE_LIB "$ERTS_LIB_DIR" \
--vm-args "$REL_DIR/remote.vm.args" \ --vm-args "$REL_DIR/remote.vm.args" \
--erl "-start_epmd false -epmd_module ekka_epmd" \ --erl "-start_epmd false" \
--erl "-epmd_module ekka_epmd" \
--erl "+P 65536" \
--erl "+Q 65536" \
--erl "+S 2" \
--rpc-eval "$NAME" "$@" --rpc-eval "$NAME" "$@"
else else
echo "EMQX node is not an Elixir node" echo "EMQX node is not an Elixir node"

View File

@ -1,6 +1,6 @@
#!/usr/bin/env escript #!/usr/bin/env escript
%% -*- mode: erlang;erlang-indent-level: 4;indent-tabs-mode: nil -*- %% -*- mode: erlang;erlang-indent-level: 4;indent-tabs-mode: nil -*-
%%! +Q 65536 +S 1 %%! +P 65536 +Q 65536 +S 1
%% ex: ft=erlang ts=4 sw=4 et %% ex: ft=erlang ts=4 sw=4 et
%% ------------------------------------------------------------------- %% -------------------------------------------------------------------
%% %%