Skip to content

Maximum number of Erlang processes and atoms can be configured via environment variables #1528

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

Merged
merged 6 commits into from
Feb 26, 2018

Conversation

gerhard
Copy link
Contributor

@gerhard gerhard commented Feb 23, 2018

Proposed Changes

  1. Allow maximum number of Erlang processes to be configured via an environment variable
  2. Allow maximum number of Erlang atoms to be configured via an environment variable

Types of Changes

Checklist

  • I have read the CONTRIBUTING.md document
  • I have signed the CA (see https://cla.pivotal.io/sign/rabbitmq)
  • All tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • Any dependent changes have been merged and published in related repositories

This property is essential for nodes that need to handle many
connections / channels / queues.

Related to #1513
This was the only property in SERVER_ERL_ARGS that was not configurable.
Even though it's unlikely that this will need to be increased above the
existing 5 million default, we are consistent in allowing all properties
in SERVER_ERL_ARGS to be cofigured.
@gerhard gerhard changed the title Configurable max procs max atoms Maximum number of Erlang processes and atoms can be configured via environment variables Feb 23, 2018
@gerhard
Copy link
Contributor Author

gerhard commented Feb 23, 2018

Proposing to add this to v3.6.x & v3.8.x

@michaelklishin
Copy link
Collaborator

It can already be done using RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS but I have no objections to these two.

@lukebakken
Copy link
Collaborator

I'd say apply this to v3.7.x and master since RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS provides this function for v3.6.x.

@michaelklishin
Copy link
Collaborator

michaelklishin commented Feb 23, 2018

If this is driven by the needs of the BOSH release (which is a guess, perhaps @gerhard can elaborate), I have no objections to having this in 3.6.x as well.

lukebakken
lukebakken previously approved these changes Feb 23, 2018
@gerhard
Copy link
Contributor Author

gerhard commented Feb 23, 2018

Yes, I was actually thinking about RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS and thought that it was weird to have some erl properties such as +zddbl & +stbt configurable explicitly, and others such as +P & +t only configurable as overrides via $RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS.

@gerhard
Copy link
Contributor Author

gerhard commented Feb 23, 2018

The BOSH release supports both RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS & specific properties, so it's not an issue - both approaches will yield the same result. This PR is driven by making all properties in SERVER_ERL_ARGS equally configurable.

gerhard added a commit to rabbitmq/rabbitmq-server-boshrelease that referenced this pull request Feb 23, 2018
This will not work in all RabbitMQ versions, use
rabbitmq-server.additional_erl_args for greater cross-version
compatibility.

Related to rabbitmq/rabbitmq-server#1528
Copy link
Collaborator

@michaelklishin michaelklishin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I try to run a node on this branch, it fails with

gmake run-broker

 GEN    /var/folders/gp/53t98z011678vk9rkcb_s6ph0000gn/T//rabbitmq-test-instances/rabbit/enabled_plugins
All plugins have been disabled.
Applying plugin configuration to rabbit@warp10...
Plugin configuration unchanged.
 GEN    /var/folders/gp/53t98z011678vk9rkcb_s6ph0000gn/T//rabbitmq-test-instances/test.config
MAKE="gmake" ERL_LIBS="/Users/antares/Development/RabbitMQ/umbrella.git/deps/rabbit/apps:/usr/local/Cellar/elixir/1.6.0_1/bin/../lib/elixir" RABBITMQ_NODENAME="rabbit" RABBITMQ_NODE_IP_ADDRESS="" RABBITMQ_NODE_PORT="" RABBITMQ_PID_FILE="/var/folders/gp/53t98z011678vk9rkcb_s6ph0000gn/T//rabbitmq-test-instances/rabbit/rabbit.pid" RABBITMQ_LOG_BASE="/var/folders/gp/53t98z011678vk9rkcb_s6ph0000gn/T//rabbitmq-test-instances/rabbit/log" RABBITMQ_MNESIA_BASE="/var/folders/gp/53t98z011678vk9rkcb_s6ph0000gn/T//rabbitmq-test-instances/rabbit/mnesia" RABBITMQ_MNESIA_DIR="/var/folders/gp/53t98z011678vk9rkcb_s6ph0000gn/T//rabbitmq-test-instances/rabbit/mnesia/rabbit" RABBITMQ_SCHEMA_DIR="/var/folders/gp/53t98z011678vk9rkcb_s6ph0000gn/T//rabbitmq-test-instances/rabbit/schema" RABBITMQ_GENERATED_CONFIG_DIR="/var/folders/gp/53t98z011678vk9rkcb_s6ph0000gn/T//rabbitmq-test-instances/rabbit/config" RABBITMQ_PLUGINS_DIR="/Users/antares/Development/RabbitMQ/umbrella.git/deps/rabbit/plugins" RABBITMQ_PLUGINS_EXPAND_DIR="/var/folders/gp/53t98z011678vk9rkcb_s6ph0000gn/T//rabbitmq-test-instances/rabbit/plugins" RABBITMQ_SERVER_START_ARGS="" RABBITMQ_ENABLED_PLUGINS_FILE="/var/folders/gp/53t98z011678vk9rkcb_s6ph0000gn/T//rabbitmq-test-instances/rabbit/enabled_plugins" \
  RABBITMQ_ALLOW_INPUT=true \
  RABBITMQ_CONFIG_FILE=/var/folders/gp/53t98z011678vk9rkcb_s6ph0000gn/T//rabbitmq-test-instances/test \
  /Users/antares/Development/RabbitMQ/umbrella.git/deps/rabbit/scripts/rabbitmq-server
bad number of processes =1048576
Usage: beam.smp [flags] [ -- [init_args] ]
The flags are:

@@ -87,8 +87,14 @@ DEFAULT_SCHEDULER_BIND_TYPE="db"
DEFAULT_DISTRIBUTION_BUFFER_SIZE=128000
[ "x" = "x$RABBITMQ_DISTRIBUTION_BUFFER_SIZE" ] && RABBITMQ_DISTRIBUTION_BUFFER_SIZE=${DEFAULT_DISTRIBUTION_BUFFER_SIZE}

DEFAULT_MAX_NUMBER_OF_PROCESSES=1048576
[ "x" = "x$RABBITMQ_MAX_NUMBER_OF_PROCESSES" ] && RABBITMQ_MAX_NUMBER_OF_PROCESSES=="${DEFAULT_MAX_NUMBER_OF_PROCESSES}"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

== seems to be bash-specific and is not available in zsh.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad, definitely a typo.

… with RABBITMQ_, adjust Unix and Windows files accordingly
@lukebakken lukebakken self-requested a review February 23, 2018 19:51
@lukebakken lukebakken dismissed their stale review February 23, 2018 19:51

I missed some errors

@lukebakken
Copy link
Collaborator

OK I tested my latest changes by creating a rabbitmq-env.conf file with these contents:

lbakken@shostakovich ~/issues/rabbitmq/rabbitmq-server/gh-1528
$ cat rabbitmq-env.conf 
SCHEDULER_BIND_TYPE=u
DISTRIBUTION_BUFFER_SIZE=65536
MAX_NUMBER_OF_PROCESSES=131072
MAX_NUMBER_OF_ATOMS=196608

Then running from this branch with this command:

make RABBITMQ_NODENAME='rabbit@shostakovich' RABBITMQ_CONF_ENV_FILE=$HOME/issues/rabbitmq/rabbitmq-server/gh-1528/rabbitmq-env.conf run-broker

ps -ef output shows that the settings were applied:

$ ps -ef|fgrep beam.smp
lbakken  25122 22593 15 11:55 pts/2    00:00:02 /home/lbakken/development/erlang/installs/19.3/erts-8.3/bin/beam.smp -W w -A 128 -P 131072 -t 196608 -stbt u -zdbbl 65536 -K true -- -root /home/lbakken/development/erlang/installs/19.3 -progname erl -- -home /home/lbakken -- -kernel shell_history enabled -pa /home/lbakken/development/rabbitmq/rabbitmq-server/ebin -s rabbit boot -sname rabbit@shostakovich -boot start_sasl -config /tmp/rabbitmq-test-instances/test -kernel inet_default_connect_options [{nodelay,true}] -sasl errlog_type error -sasl sasl_error_logger false -rabbit lager_log_root "/tmp/rabbitmq-test-instances/rabbit@shostakovich/log" -rabbit lager_default_file "/tmp/rabbitmq-test-instances/rabbit@shostakovich/log/[email protected]" -rabbit lager_upgrade_file "/tmp/rabbitmq-test-instances/rabbit@shostakovich/log/rabbit@shostakovich_upgrade.log" -rabbit enabled_plugins_file "/tmp/rabbitmq-test-instances/rabbit@shostakovich/enabled_plugins" -rabbit plugins_dir "/home/lbakken/development/rabbitmq/rabbitmq-server/plugins" -rabbit plugins_expand_dir "/tmp/rabbitmq-test-instances/rabbit@shostakovich/plugins" -os_mon start_cpu_sup false -os_mon start_disksup false -os_mon start_memsup false -mnesia dir "/tmp/rabbitmq-test-instances/rabbit@shostakovich/mnesia/rabbit@shostakovich" -kernel inet_dist_listen_min 25672 -kernel inet_dist_listen_max 25672

Testing Windows next.

@michaelklishin
Copy link
Collaborator

I can confirm that @lukebakken's changes make the issue go away. I was also able to config SCHEDULER_BIND_TYPE and a few other things via rabbitmq-env.conf.

Doing more testing next.

@lukebakken
Copy link
Collaborator

lukebakken commented Feb 23, 2018

Tested on Windows 8.1 using this alpha build with all of the scripts/*.bat files copied from this branch into sbin. After doing the copy, you must run rabbitmq-service.bat remove then rabbitmq-service.bat install for erlsrv.exe to be installed with the correct arguments for erl.exe. Contents of %AppData%\RabbitMQ\rabbitmq-conf-env.bat:

set SCHEDULER_BIND_TYPE=u
set DISTRIBUTION_BUFFER_SIZE=65536
set MAX_NUMBER_OF_PROCESSES=131072
set MAX_NUMBER_OF_ATOMS=196608

@gerhard
Copy link
Contributor Author

gerhard commented Feb 23, 2018

We used to have the RABBITMQ_ prefix since #873. The sudo logic used to be:

if RABBITMQ_SCHEDULER_BIND_TYPE env is set
then use this value in SERVER_ERL_ARGS
otherwise set RABBITMQ_SCHEDULER_BIND_TYPE to DEFAULT_SCHEDULER_BIND_TYPE

Was this incorrect?

@michaelklishin
Copy link
Collaborator

michaelklishin commented Feb 23, 2018

@gerhard the docs suggest rabbitmq-env.conf should contain var, which takes precedence over DEFAULT_var. Both are overriden by RABBITMQ_var from the environment should it be set. This logic has been around for years. #873 therefore is incomplete.

@gerhard
Copy link
Contributor Author

gerhard commented Feb 26, 2018

@michaelklishin got it. So we basically need to support both RABBITMQ_var_name & var_name defined in rabbitmq-env.conf. I will update the tests to cover both cases.

Covers the following variables:

* RABBITMQ_SCHEDULER_BIND_TYPE & SCHEDULER_BIND_TYPE
* RABBITMQ_DISTRIBUTION_BUFFER_SIZE & DISTRIBUTION_BUFFER_SIZE
* RABBITMQ_MAX_NUMBER_OF_PROCESSES & MAX_NUMBER_OF_PROCESSES
* RABBITMQ_MAX_NUMBER_OF_ATOMS & MAX_NUMBER_OF_ATOMS
@gerhard
Copy link
Contributor Author

gerhard commented Feb 26, 2018

@michaelklishin should be ready to merge.

@michaelklishin michaelklishin merged commit 631f822 into v3.7.x Feb 26, 2018
@lukebakken lukebakken deleted the configurable-max-procs-max-atoms branch February 26, 2018 15:28
@michaelklishin michaelklishin added this to the 3.7.4 milestone Feb 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants