diff options
author | Emile Joubert <emile@rabbitmq.com> | 2011-08-17 12:25:14 +0100 |
---|---|---|
committer | Emile Joubert <emile@rabbitmq.com> | 2011-08-17 12:25:14 +0100 |
commit | 5741ad0382901ef0c57f957446e8ba38f1ba5f19 (patch) | |
tree | 761c24a673df02e9fd17913e557dc0d4f47c5ba3 | |
parent | 5a8b09461be33b98dce687233d7b465a3247868b (diff) | |
download | rabbitmq-server-5741ad0382901ef0c57f957446e8ba38f1ba5f19.tar.gz |
Change vm_memory_high_watermark while running
-rw-r--r-- | docs/rabbitmqctl.1.xml | 32 | ||||
-rw-r--r-- | src/rabbit.erl | 2 | ||||
-rw-r--r-- | src/rabbit_control.erl | 5 |
3 files changed, 38 insertions, 1 deletions
diff --git a/docs/rabbitmqctl.1.xml b/docs/rabbitmqctl.1.xml index ba87c836..c506ad87 100644 --- a/docs/rabbitmqctl.1.xml +++ b/docs/rabbitmqctl.1.xml @@ -1296,7 +1296,7 @@ <para> Displays broker status information such as the running applications on the current Erlang node, RabbitMQ and - Erlang versions and OS name. (See + Erlang versions, OS name and memory statistics. (See the <command>cluster_status</command> command to find out which nodes are clustered and running.) </para> @@ -1373,7 +1373,37 @@ </para> </listitem> </varlistentry> + </variablelist> + </refsect2> + <refsect2> + <title>Memory Management</title> + <variablelist> + + <varlistentry> + <term><cmdsynopsis><command>set_vm_memory_high_watermark</command> <arg choice="req"><replaceable>fraction</replaceable></arg></cmdsynopsis></term> + <listitem> + <variablelist> + <varlistentry> + <term>fraction</term> + <listitem><para>The new memory threshhold fraction as a floating point number between + 0.0 and 1.0 . The fractional part is compulsory.</para></listitem> + </varlistentry> + </variablelist> + <para> + Sets the memory threshhold fraction at which memory-based flow control is + triggered, until the broker restarts. This command is intended for use in + systems that support hot-swappable RAM. The corresponding configuration + setting should also be changed when the effects of this command should + survive a broker restart. Use the <command>status</command> command to + confirm the currently active threshhold. + </para> + <screen role="example">rabbitmqctl set_vm_memory_high_watermark 0.4</screen> + <para role="example"> + This command sets the memory threshhold fraction to the default value of 40%. + </para> + </listitem> + </varlistentry> </variablelist> </refsect2> </refsect1> diff --git a/src/rabbit.erl b/src/rabbit.erl index 46f7d9d1..138693f5 100644 --- a/src/rabbit.erl +++ b/src/rabbit.erl @@ -235,6 +235,8 @@ status() -> {running_applications, application:which_applications()}, {os, os:type()}, {erlang_version, erlang:system_info(system_version)}, + {vm_memory_high_watermark, + vm_memory_monitor:get_vm_memory_high_watermark()}, {memory, erlang:memory()}]. environment() -> diff --git a/src/rabbit_control.erl b/src/rabbit_control.erl index e8afed0c..b386e338 100644 --- a/src/rabbit_control.erl +++ b/src/rabbit_control.erl @@ -324,6 +324,11 @@ action(trace_off, Node, [], Opts, Inform) -> Inform("Stopping tracing for vhost ~p", [VHost]), rpc_call(Node, rabbit_trace, stop, [list_to_binary(VHost)]); +action(set_vm_memory_high_watermark, Node, [Arg], _Opts, Inform) -> + Frac = list_to_float("0" ++ Arg), + Inform("Setting memory threshhold on ~p to ~p", [Node, Frac]), + rpc_call(Node, vm_memory_monitor, set_vm_memory_high_watermark, [Frac]); + action(set_permissions, Node, [Username, CPerm, WPerm, RPerm], Opts, Inform) -> VHost = proplists:get_value(?VHOST_OPT, Opts), Inform("Setting permissions for user ~p in vhost ~p", [Username, VHost]), |