Skip to content
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

Keep track of connections, introduce per-vhost limits #891

Merged
merged 36 commits into from
Aug 26, 2016
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
9adb6cd
Keep track of connections, introduce per-vhost limits
michaelklishin Jul 22, 2016
d4aaae9
Use ?PER_VHOST_COUNTER_TABLE here
michaelklishin Jul 26, 2016
995c430
Correct a type spec
michaelklishin Jul 26, 2016
747b41a
Switch to a single table per node for connection tracking
michaelklishin Aug 2, 2016
ed4fe7e
Merge branch 'master' into rabbitmq-server-500-squashed
michaelklishin Aug 2, 2016
295c7b2
Remove a duplicate comment
michaelklishin Aug 4, 2016
87c2d6f
Inline
michaelklishin Aug 4, 2016
95b6e8f
Remove a debug message
michaelklishin Aug 4, 2016
da08e95
Drop the _test prefixes, remove some dead code
michaelklishin Aug 4, 2016
0457b58
Simplify
michaelklishin Aug 4, 2016
a9fbb98
Use rabbit_misc:pget/2 here
michaelklishin Aug 5, 2016
e447910
Refactor
michaelklishin Aug 5, 2016
363d0a1
One more test case
michaelklishin Aug 5, 2016
0199aa9
Use negative values to disable per-vhost limits, 0 to refuse all conn…
michaelklishin Aug 6, 2016
d36d1d4
More test cases
michaelklishin Aug 6, 2016
cb4835b
Merge branch 'master' into rabbitmq-server-500-squashed
michaelklishin Aug 10, 2016
f012c49
Merge branch 'master' into rabbitmq-server-500-squashed
michaelklishin Aug 10, 2016
efc0f99
We can use record_info/2 here; log errors in table creation
michaelklishin Aug 10, 2016
ede361d
Emit a node_deleted event when a node is removed from the cluster
michaelklishin Aug 10, 2016
0363bac
Delete connection tracking tables for nodes removed from the cluster
michaelklishin Aug 14, 2016
93682bd
Rename function
michaelklishin Aug 14, 2016
e25e906
Merge branch 'master' into rabbitmq-server-500-squashed
michaelklishin Aug 14, 2016
9febe15
Combine map/2 and foldl/3
michaelklishin Aug 16, 2016
0db9986
Reformat with emacs
michaelklishin Aug 18, 2016
769472f
Use lists:foldl/3 only
michaelklishin Aug 18, 2016
bbe671d
record_info/2 is appropriate here
michaelklishin Aug 18, 2016
dad8511
Squash warnings
michaelklishin Aug 18, 2016
754feab
Merge branch 'master' into rabbitmq-server-500-squashed
michaelklishin Aug 18, 2016
922a43c
Merge branch 'master' into rabbitmq-server-500-squashed
michaelklishin Aug 23, 2016
2994c42
Merge branch 'master' into rabbitmq-server-500-squashed
michaelklishin Aug 24, 2016
2527a85
rabbit_mnesia:forget_cluster_node/2: Skip event if node if offline
dumbbell Aug 25, 2016
f43f6cd
rabbit_mnesia_rename: Backup local tables only
dumbbell Aug 25, 2016
d431320
per_vhost_connection_limit_SUITE: Sleep 500ms after connection open/c…
dumbbell Aug 25, 2016
99f7562
cluster_rename_SUITE: Lower the testsuite timeout
dumbbell Aug 25, 2016
a5cdde1
Remove dead code left from a previous incarnation of the patch
dumbbell Aug 26, 2016
a660b70
per_vhost_connection_limit_SUITE: Add a test around cluster rename
dumbbell Aug 26, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 52 additions & 3 deletions docs/rabbitmqctl.1.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1214,6 +1214,55 @@
</variablelist>
</refsect2>

<refsect2>
<title>Virtual Host Limits</title>
<para>
It is possible to enforce certain limits on virtual hosts.
</para>
<variablelist>
<varlistentry>
<term><cmdsynopsis><command>set_vhost_limits</command> <arg choice="opt">-p <replaceable>vhostpath</replaceable></arg> <arg choice="req"><replaceable>definition</replaceable></arg></cmdsynopsis></term>
<listitem>
<para>
Sets virtual host limits
</para>
<variablelist>
<varlistentry>
<term>definition</term>
<listitem><para>
The definition of the limits, as a
JSON term. In most shells you are very likely to
need to quote this.

Recognised limits: max-connections (0 means "no limit").
</para></listitem>
</varlistentry>
</variablelist>
<para role="example-prefix">For example:</para>
<screen role="example">rabbitmqctl set_vhost_limits -p qa_env '{"max-connections": 1024}'</screen>
<para role="example">
This command limits the max number of concurrent connections in vhost <command>qa_env</command>
to 1024.
</para>
</listitem>
</varlistentry>

<varlistentry>
<term><cmdsynopsis><command>clear_vhost_limits</command> <arg choice="opt">-p <replaceable>vhostpath</replaceable></arg></cmdsynopsis></term>
<listitem>
<para>
Clears virtual host limits
</para>
<para role="example-prefix">For example:</para>
<screen role="example">rabbitmqctl clear_vhost_limits -p qa_env</screen>
<para role="example">
This command clears vhost limits in vhost <command>qa_env</command>.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect2>

<refsect2>
<title>Server Status</title>
<para>
Expand Down Expand Up @@ -2036,9 +2085,9 @@
<varlistentry>
<term>fraction</term>
<listitem><para>
Limit relative to the total amount available RAM
as a non-negative floating point number.
Values lower than 1.0 can be dangerous and
Limit relative to the total amount available RAM
as a non-negative floating point number.
Values lower than 1.0 can be dangerous and
should be used carefully.
</para></listitem>
</varlistentry>
Expand Down
1 change: 0 additions & 1 deletion include/rabbit_cli.hrl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
-define(OFFLINE_OPT, "--offline").
-define(ONLINE_OPT, "--online").


-define(NODE_DEF(Node), {?NODE_OPT, {option, Node}}).
-define(QUIET_DEF, {?QUIET_OPT, flag}).
-define(VHOST_DEF, {?VHOST_OPT, {option, "/"}}).
Expand Down
5 changes: 5 additions & 0 deletions src/rabbit.erl
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,11 @@
{mfa, {rabbit_direct, boot, []}},
{requires, log_relay}]}).

-rabbit_boot_step({connection_tracking,
[{description, "sets up internal storage for node-local connections"},
{mfa, {rabbit_connection_tracking, boot, []}},
{requires, log_relay}]}).

-rabbit_boot_step({networking,
[{mfa, {rabbit_networking, boot, []}},
{requires, log_relay}]}).
Expand Down
Loading