From 8276ae54a12d9e919775c1d67fe7ad1a03710d94 Mon Sep 17 00:00:00 2001 From: zmstone Date: Mon, 3 Jun 2024 11:04:38 +0200 Subject: [PATCH] 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. --- bin/emqx | 11 ++++++++++- bin/nodetool | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/bin/emqx b/bin/emqx index 1db57d7e8..b504ce8b4 100755 --- a/bin/emqx +++ b/bin/emqx @@ -337,6 +337,9 @@ compatiblity_info() { # set crash-dump bytes to zero to ensure no crash dump is generated when erl crashes env ERL_CRASH_DUMP_BYTES=0 "$BINDIR/$PROGNAME" \ -noshell \ + +S 2 \ + +P 65536 \ + +Q 65536 \ -boot "$REL_DIR/start_clean" \ -boot_var RELEASE_LIB "$ERTS_LIB_DIR/lib" \ -eval "$COMPATIBILITY_CHECK" @@ -408,6 +411,7 @@ remsh() { -setcookie "$COOKIE" \ -hidden \ -kernel net_ticktime "$TICKTIME" \ + +P 65536 \ +Q 65536 \ +S 2 \ $EPMD_ARGS @@ -420,6 +424,7 @@ remsh() { --erl "-kernel net_ticktime $TICKTIME" \ --erl "$EPMD_ARGS" \ --erl "$NAME_TYPE $id" \ + --erl "+P 65536" \ --erl "+Q 65536" \ --erl "+S 2" \ --boot "$REL_DIR/start_clean" @@ -1307,7 +1312,11 @@ case "${COMMAND}" in --boot "$REL_DIR/start_clean" \ --boot-var RELEASE_LIB "$ERTS_LIB_DIR" \ --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" "$@" else echo "EMQX node is not an Elixir node" diff --git a/bin/nodetool b/bin/nodetool index e1d45c88d..bfefd0ed9 100755 --- a/bin/nodetool +++ b/bin/nodetool @@ -1,6 +1,6 @@ #!/usr/bin/env escript %% -*- 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 %% ------------------------------------------------------------------- %%