Skip to content

Commit d72ff92

Browse files
committed
Expose mqtt.mailbox_soft_limit via Cuttlefish
1 parent 869333c commit d72ff92

File tree

2 files changed

+30
-3
lines changed

2 files changed

+30
-3
lines changed

deps/rabbitmq_mqtt/priv/schema/rabbitmq_mqtt.schema

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,3 +266,21 @@ end}.
266266

267267
{mapping, "mqtt.durable_queue_type", "rabbitmq_mqtt.durable_queue_type",
268268
[{datatype, {enum, [classic, quorum]}}]}.
269+
270+
%% If feature flag rabbit_mqtt_qos0_queue is enabled, a pseudo queue of type rabbit_mqtt_qos0_queue is
271+
%% created for an MQTT "Clean Session" that subscribes with QoS 0. This queue type holds MQTT messages
272+
%% directly in the MQTT connection process mailbox. This queue type has no flow control which
273+
%% means MQTT messages might arrive faster in the Erlang mailbox than being sent to the subscribing MQTT
274+
%% client. To protect against high memory usage, RabbitMQ intentionally drops QoS 0 messages if both
275+
%% 1.) the number of messages in the MQTT connection process mailbox exceeds mailbox_soft_limit, and
276+
%% 2.) the socket sending to the MQTT client is busy (i.e. not sending fast enough).
277+
%% Note that there can be other messages in the mailbox (e.g. MQTT messages sent from the MQTT client to
278+
%% RabbitMQ or confirmations from another queue type to the MQTT connection process) which are
279+
%% obviously not dropped. However, these other messages also contribute to the `mailbox_soft_limit`.
280+
%% Setting mailbox_soft_limit to 0 disables the overload protection mechanism to drop QoS 0 messages.
281+
%% Setting mailbox_soft_limit to a very high value decreases the likelihood of intentionally dropping
282+
%% QoS 0 messages while increasing the risk of causing a cluster wide memory alarm.
283+
%%
284+
%% {mailbox_soft_limit, 30},
285+
{mapping, "mqtt.mailbox_soft_limit", "rabbitmq_mqtt.mailbox_soft_limit",
286+
[{datatype, integer}]}.

deps/rabbitmq_mqtt/test/config_schema_SUITE_data/rabbitmq_mqtt.snippets

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
mqtt.tcp_listen_options.backlog = 128
1616
mqtt.tcp_listen_options.nodelay = true
1717
mqtt.durable_queue_type = classic
18-
mqtt.proxy_protocol = false",
18+
mqtt.proxy_protocol = false
19+
mqtt.mailbox_soft_limit = 200",
1920
[{rabbit,[{tcp_listeners,[5672]}]},
2021
{rabbitmq_mqtt,
2122
[{default_user,<<"guest">>},
@@ -30,7 +31,8 @@
3031
{tcp_listeners,[1883]},
3132
{tcp_listen_options,[{backlog,128},{nodelay,true}]},
3233
{durable_queue_type,classic},
33-
{proxy_protocol,false}]}],
34+
{proxy_protocol,false},
35+
{mailbox_soft_limit,200}]}],
3436
[rabbitmq_mqtt]},
3537

3638
{listener_tcp_options,
@@ -143,4 +145,11 @@
143145
{retained_message_store_dets_sync_interval,2000},
144146
{ssl_listeners,[]},
145147
{tcp_listeners,[1883]}]}],
146-
[rabbitmq_mqtt]}].
148+
[rabbitmq_mqtt]},
149+
150+
{mailbox_soft_limit,
151+
"mqtt.mailbox_soft_limit = 30",
152+
[{rabbitmq_mqtt,[
153+
{mailbox_soft_limit, 30}]}],
154+
[rabbitmq_mqtt]}
155+
].

0 commit comments

Comments
 (0)