Skip to content

Commit 88485d9

Browse files
Merge branch 'cloudamqp-max_connections' into stable
2 parents 1409ce2 + 7db6159 commit 88485d9

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ define PROJECT_ENV
2525
%% breaks the QPid Java client
2626
{frame_max, 131072},
2727
{channel_max, 0},
28+
{connection_max, infinity},
2829
{heartbeat, 60},
2930
{msg_store_file_size_limit, 16777216},
3031
{fhc_write_buffering, true},

docs/rabbitmq.config.example

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,25 @@
218218
%%
219219
%% {channel_max, 0},
220220

221+
%% Set the max permissible number of client connections to the node.
222+
%% `infinity` means "no limit".
223+
%%
224+
%% This limit applies to client connections to all listeners (regardless of
225+
%% the protocol, whether TLS is used and so on). CLI tools and inter-node
226+
%% connections are exempt.
227+
%%
228+
%% When client connections are rapidly opened in succession, it is possible
229+
%% for the total connection count to go slightly higher than the configured limit.
230+
%% The limit works well as a general safety measure.
231+
%%
232+
%% Clients that are hitting the limit will see their TCP connections fail or time out.
233+
%%
234+
%% Introduced in 3.6.13.
235+
%%
236+
%% Related doc guide: http://www.rabbitmq.com/networking.html.
237+
%%
238+
%% {connection_max, infinity},
239+
221240
%% TCP socket options.
222241
%%
223242
%% Related doc guide: http://www.rabbitmq.com/networking.html.

src/tcp_listener_sup.erl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,11 @@ start_link(IPAddress, Port, Transport, SocketOpts, ProtoSup, ProtoOpts, OnStartu
4949
init({IPAddress, Port, Transport, SocketOpts, ProtoSup, ProtoOpts, OnStartup, OnShutdown,
5050
ConcurrentAcceptorCount, Label}) ->
5151
{ok, AckTimeout} = application:get_env(rabbit, ssl_handshake_timeout),
52+
MaxConnections = rabbit_misc:get_env(rabbit, connection_max, infinity),
5253
{ok, {{one_for_all, 10, 10}, [
5354
ranch:child_spec({acceptor, IPAddress, Port}, ConcurrentAcceptorCount,
5455
Transport, [{port, Port}, {ip, IPAddress},
55-
{max_connections, infinity},
56+
{max_connections, MaxConnections},
5657
{ack_timeout, AckTimeout},
5758
{connection_type, supervisor}|SocketOpts],
5859
ProtoSup, ProtoOpts),

0 commit comments

Comments
 (0)