Skip to content

Commit f1a7045

Browse files
authored
Merge pull request #292981 from PatAltimore/patricka-memory-profile
Add MQTT broker memory profile detail
2 parents 2c7e501 + 07ee34f commit f1a7045

File tree

1 file changed

+46
-2
lines changed

1 file changed

+46
-2
lines changed

articles/iot-operations/manage-mqtt-broker/howto-configure-availability-scale.md

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ ms.topic: how-to
77
ms.subservice: azure-mqtt-broker
88
ms.custom:
99
- ignite-2023
10-
ms.date: 11/11/2024
10+
ms.date: 03/17/2025
1111

1212
#CustomerIntent: As an operator, I want to understand the settings for the MQTT broker so that I can configure it for high availability and scale.
1313
ms.service: azure-iot-operations
@@ -137,6 +137,8 @@ For example, if your cluster has three nodes, each with eight CPU cores, then se
137137

138138
## Configure memory profile
139139

140+
The memory profile specifies the broker's memory usage for resource-limited environments. You can choose from predefined memory profiles that have different memory usage characteristics. The memory profile setting is used to configure the memory usage of the frontend and backend replicas. The memory profile interacts with the cardinality settings to determine the total memory usage of the broker.
141+
140142
> [!IMPORTANT]
141143
> This setting requires you to modify the Broker resource. It's configured only at initial deployment by using the Azure CLI or the Azure portal. A new deployment is required if Broker configuration changes are needed. To learn more, see [Customize default Broker](./overview-broker.md#customize-default-broker).
142144
@@ -162,14 +164,17 @@ To learn more, see [`az iot ops create` optional parameters](/cli/azure/iot/ops#
162164

163165
---
164166

165-
There are a few memory profiles to choose from, each with different memory usage characteristics.
167+
There are predefined memory profiles with different memory usage characteristics for publishing messages. There isn't a limit on the number of sessions or subscriptions that the broker can handle. The memory profile governs only the memory usage for PUBLISH traffic.
166168

167169
### Tiny
168170

171+
Use this profile when you have limited memory resources and client publish traffic is low.
172+
169173
When you use this profile:
170174

171175
- Maximum memory usage of each frontend replica is approximately 99 MiB, but the actual maximum memory usage might be higher.
172176
- Maximum memory usage of each backend replica is approximately 102 MiB multiplied by the number of backend workers, but the actual maximum memory usage might be higher.
177+
- The maximum size of the incoming buffer for PUBLISH data is approximately 16 MiB per backend worker. However, the effective size may be lower due to backpressure mechanisms, which activate when the buffer reaches 75% capacity resulting in a buffer size of approximately 12 MiB. Rejected packets have a PUBACK response with a *Quota exceeded* error code.
173178

174179
Recommendations when you use this profile:
175180

@@ -178,10 +183,13 @@ Recommendations when you use this profile:
178183

179184
### Low
180185

186+
Use this profile when you have limited memory resources and clients publish small packets.
187+
181188
When you use this profile:
182189

183190
- Maximum memory usage of each frontend replica is approximately 387 MiB, but the actual maximum memory usage might be higher.
184191
- Maximum memory usage of each backend replica is approximately 390 MiB multiplied by the number of backend workers, but the actual maximum memory usage might be higher.
192+
- The maximum size of the incoming buffer for PUBLISH data is approximately 64 MiB per backend worker. However, the effective size may be lower due to backpressure mechanisms, which activate when the buffer reaches 75% capacity resulting in a buffer size of approximately 48 MiB. Rejected packets have a PUBACK response with a *Quota exceeded* error code.
185193

186194
Recommendations when you use this profile:
187195

@@ -190,16 +198,52 @@ Recommendations when you use this profile:
190198

191199
### Medium
192200

201+
Use this profile when you need to handle a moderate number of client messages.
202+
193203
Medium is the default profile.
194204

195205
- Maximum memory usage of each frontend replica is approximately 1.9 GiB, but the actual maximum memory usage might be higher.
196206
- Maximum memory usage of each backend replica is approximately 1.5 GiB multiplied by the number of backend workers, but the actual maximum memory usage might be higher.
197207
- Maximum message size is 64 MB.
208+
- The maximum size of the incoming buffer for PUBLISH data is approximately 576 MiB per backend worker. However, the effective size may be lower due to backpressure mechanisms, which activate when the buffer reaches 75% capacity resulting in a buffer size of approximately 432 MiB. Rejected packets have a PUBACK response with a *Quota exceeded* error code.
198209

199210
### High
200211

212+
Use this profile when you need to handle a large number of client messages.
213+
201214
- Maximum memory usage of each frontend replica is approximately 4.9 GiB, but the actual maximum memory usage might be higher.
202215
- Maximum memory usage of each backend replica is approximately 5.8 GiB multiplied by the number of backend workers, but the actual maximum memory usage might be higher.
216+
- The maximum size of the incoming buffer for PUBLISH data is approximately 2 GiB per backend worker. However, the effective size may be lower due to backpressure mechanisms, which activate when the buffer reaches 75% capacity resulting in a buffer size of approximately 1.5 GiB. Rejected packets have a PUBACK response with a *Quota exceeded* error code.
217+
218+
219+
## Calculate total memory usage
220+
221+
The memory profile setting specifies the memory usage for each frontend and backend replica and interacts with the cardinality settings. You can calculate the total memory usage using the formula:
222+
223+
*M_total = R_fe * M_fe + (P_be * RF_be) * M_be * W_be*
224+
225+
Where:
226+
227+
| Variable | Description |
228+
|----------|-------------|
229+
| *M_total* | Total memory usage |
230+
| *R_fe* | The number of frontend replicas |
231+
| *M_fe*| The memory usage of each frontend replica |
232+
| *P_be*| The number of backend partitions |
233+
| *RF_be* | Backend redundancy factor |
234+
| *M_be* | The memory usage of each backend replica |
235+
| *W_be* | The number of workers per backend replica |
236+
237+
For example if you choose the *Medium* memory profile, the profile has a frontend memory usage of 1.9 GB and backend memory usage of 1.5 GB. Assume that the broker configuration is 2 frontend replicas, 2 backend partitions, and a backend redundancy factor of 2. The total memory usage is:
238+
239+
*2 * 1.9 GB + (2 * 2) * 1.5 GB * 2* = 15.8 GB
240+
241+
In comparison, the *Tiny* memory profile has a frontend memory usage of 99 MiB and backend memory usage of 102 MiB. If you assume the same broker configuration, the total memory usage is:
242+
243+
*2 * 99 MB + (2 * 2) * 102 MB * 2 = 198 MB + 816 MB* = 1.014 GB.
244+
245+
> [!IMPORTANT]
246+
> The MQTT broker starts rejecting messages when memory is 75% full.
203247
204248
## Cardinality and Kubernetes resource limits
205249

0 commit comments

Comments
 (0)