Skip to content

Commit

Permalink
Cuttlefish schema: introduce socket_writer.gc_threshold
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelklishin committed Dec 24, 2019
1 parent 5e9e7a2 commit 7af37e5
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 3 deletions.
7 changes: 7 additions & 0 deletions docs/rabbitmq.conf.example
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@
# num_acceptors.tcp = 10
# num_acceptors.ssl = 10

## Socket writer will force GC every so many bytes transferred.
## Default is 1 GiB (`1000000000`). Set to 'off' to disable.
##
# socket_writer.gc_threshold = 1000000000
#
## To disable:
# socket_writer.gc_threshold = off

## Maximum amount of time allowed for the AMQP 0-9-1 and AMQP 1.0 handshake
## (performed after socket connection and TLS handshake) to complete, in milliseconds.
Expand Down
25 changes: 22 additions & 3 deletions priv/schema/rabbit.schema
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ fun(Conf) ->
end}.

%% Number of Erlang processes that will accept connections for the TCP
%% and SSL listeners.
%% and TLS listeners.
%%
%% {num_tcp_acceptors, 10},
%% {num_ssl_acceptors, 1},
Expand All @@ -73,13 +73,32 @@ end}.
]}.


{mapping, "socket_writer.gc_threshold", "rabbit.writer_gc_threshold", [
{datatype, [{atom, off}, integer]}
]}.

{translation, "rabbit.writer_gc_threshold",
fun(Conf) ->
case cuttlefish:conf_get("socket_writer.gc_threshold", Conf, undefined) of
%% missing from the config
undefined -> cuttlefish:unset();
%% explicitly disabled
off -> undefined;
Int when is_integer(Int) andalso Int > 0 ->
Int;
_ ->
cuttlefish:invalid("should be a non-negative integer")
end
end
}.

%% Maximum time for 0-9-1 handshake (after socket connection
%% and SSL handshake), in milliseconds.
%% and TLS handshake), in milliseconds.
%%
%% {handshake_timeout, 10000},

{mapping, "handshake_timeout", "rabbit.handshake_timeout", [
{datatype, integer}
{datatype, [{atom, infinity}, integer]}
]}.

%% Set to 'true' to perform reverse DNS lookups when accepting a
Expand Down
7 changes: 7 additions & 0 deletions test/config_schema_SUITE_data/rabbit.snippets
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,13 @@ ssl_options.fail_if_no_peer_cert = true",
"listeners.ssl = none",[{rabbit,[{ssl_listeners,[]}]}],[]},
{num_acceptors,
"num_acceptors.ssl = 1",[{rabbit,[{num_ssl_acceptors,1}]}],[]},

{socket_writer_gc_threshold,
"socket_writer.gc_threshold = 999666111", [{rabbit, [{writer_gc_threshold, 999666111}]}],[]},

{socket_writer_gc_threshold_off,
"socket_writer.gc_threshold = off", [{rabbit, [{writer_gc_threshold, undefined}]}],[]},

{default_user_settings,
"default_user = guest
default_pass = guest
Expand Down

0 comments on commit 7af37e5

Please sign in to comment.