Skip to content

Commit a9f869b

Browse files
Merge pull request #312029 from jlian/fix/broker-generate-resource-limits-default
Clarify generateResourceLimits.cpu default varies by deployment method
2 parents 77bc5d5 + 6544263 commit a9f869b

1 file changed

Lines changed: 78 additions & 9 deletions

File tree

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

Lines changed: 78 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ author: sethmanheim
55
ms.author: sethm
66
ms.topic: how-to
77
ms.subservice: azure-mqtt-broker
8-
ms.date: 05/14/2025
8+
ms.date: 02/20/2026
99
ms.service: azure-iot-operations
1010

1111
# 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.
@@ -251,14 +251,69 @@ In comparison, the *Tiny* memory profile has a frontend memory usage of 99 MiB a
251251
252252
## Cardinality and Kubernetes resource limits
253253

254-
To prevent resource starvation in the cluster, the broker is configured by default to [request Kubernetes CPU resource limits](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/). Scaling the number of replicas or workers proportionally increases the CPU resources required. A deployment error is emitted if there are insufficient CPU resources available in the cluster. This notification helps you avoid situations where the requested broker cardinality lacks enough resources to run optimally. It also helps to avoid potential CPU contention and pod evictions.
254+
To prevent resource starvation in the cluster, the broker can be configured to [request Kubernetes CPU resource limits](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/) based on the cardinality settings. When enabled, scaling the number of replicas or workers proportionally increases the CPU resources required. A deployment error is emitted if there are insufficient CPU resources available in the cluster. This notification helps you avoid situations where the requested broker cardinality lacks enough resources to run optimally. It also helps to avoid potential CPU contention and pod evictions.
255255

256-
The MQTT broker currently requests one (1.0) CPU unit per frontend worker and two (2.0) CPU units per backend worker. For more information, see [Kubernetes CPU resource units](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#meaning-of-cpu).
256+
> [!IMPORTANT]
257+
> The default value for `generateResourceLimits.cpu` depends on the deployment method:
258+
>
259+
> - **Azure CLI (`az iot ops create`)**: `Disabled` by default. The CLI actively sets this value to `Disabled` to avoid deployment failures on resource-constrained clusters, particularly single-node clusters where the CPU requests can exceed available resources.
260+
> - **REST API, Bicep, and ARM templates**: `Enabled` by default, as defined in the [Broker API specification](/rest/api/iotoperations/broker/create-or-update). If you deploy using these methods without explicitly setting `generateResourceLimits.cpu`, CPU resource limits are applied automatically.
261+
>
262+
> If you enable CPU resource limits, make sure your cluster has enough CPU resources to satisfy the broker's requests based on your cardinality configuration. See the CPU requirements below.
263+
264+
### Calculate CPU requirements
265+
266+
The MQTT broker requests CPU resources per pod based on the number of workers configured:
267+
268+
- **Frontend pods**: 1.0 CPU per worker
269+
- **Backend pods**: 2.0 CPU per worker
270+
271+
Use the following formulas to calculate total CPU requirements:
272+
273+
| Component | Formula |
274+
|-----------|---------|
275+
| Frontend CPU | `replicas` × `frontend.workers` × 1.0 CPU |
276+
| Backend CPU | `partitions` × `redundancyFactor` × `backend.workers` × 2.0 CPU |
277+
| **Total broker CPU** | Frontend CPU + Backend CPU |
278+
279+
For more information, see [Kubernetes CPU resource units](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#meaning-of-cpu).
280+
281+
> [!CAUTION]
282+
> The broker isn't the only component that consumes CPU on the cluster. Other Azure IoT Operations components (such as the dataflow engine, OPC UA connector, and system pods) also reserve CPU resources, typically around 200-300m in aggregate. When planning cluster capacity, make sure to account for this overhead on top of the broker's CPU requirements. If the total CPU requested by all pods exceeds the available CPU on your cluster, broker pods get stuck in a `Pending` state.
283+
284+
#### Example: small cluster
285+
286+
Consider a 2-node cluster with 4 CPU cores per node (8 cores total) with the following cardinality:
287+
288+
```json
289+
{
290+
"cardinality": {
291+
"frontend": {
292+
"replicas": 2,
293+
"workers": 2
294+
},
295+
"backendChain": {
296+
"partitions": 1,
297+
"redundancyFactor": 2,
298+
"workers": 1
299+
}
300+
}
301+
}
302+
```
303+
304+
The broker requests:
305+
306+
- **Frontend CPU**: 2 replicas × 2 workers × 1.0 = **4.0 CPU**
307+
- **Backend CPU**: 1 partition × 2 RF × 1 worker × 2.0 = **4.0 CPU**
308+
- **Total broker CPU**: **8.0 CPU**
309+
310+
Even though the cluster has 8 cores total, this deployment fails because other Azure IoT Operations components also consume CPU (~280m). The broker pods get stuck in `Pending` state with `Insufficient cpu` errors.
311+
312+
To resolve this, either add more nodes, increase cores per node, or reduce the broker cardinality.
257313

258-
For example, the following cardinality would request the following CPU resources:
314+
#### Example: larger deployment
259315

260-
- **For frontends**: 2 CPU units per frontend pod, totaling 6 CPU units.
261-
- **For backends**: 4 CPU units per backend pod (for two backend workers), times 2 (redundancy factor), times 3 (number of partitions), totaling 24 CPU units.
316+
The following cardinality requests significantly more CPU resources:
262317

263318
```json
264319
{
@@ -276,15 +331,29 @@ For example, the following cardinality would request the following CPU resources
276331
}
277332
```
278333

279-
To disable this setting, set the `generateResourceLimits.cpu` field to `Disabled` in the Broker resource.
334+
- **Frontend CPU**: 3 replicas × 2 workers × 1.0 = **6.0 CPU**
335+
- **Backend CPU**: 3 partitions × 2 RF × 2 workers × 2.0 = **24.0 CPU**
336+
- **Total broker CPU**: **30.0 CPU**
337+
338+
To change this setting, set the `generateResourceLimits.cpu` field to `Enabled` or `Disabled` in the Broker resource.
280339

281340
# [Portal](#tab/portal)
282341

283-
Changing the `generateResourceLimits` field isn't supported in the Azure portal. To disable this setting, use the Azure CLI.
342+
Changing the `generateResourceLimits` field isn't supported in the Azure portal. To change this setting, use the Azure CLI.
284343

285344
# [Azure CLI](#tab/azure-cli)
286345

287-
Prepare a Broker configuration file in JSON format, which includes the desired properties of the [Resource Manager `microsoft.iotoperations/instances/brokers` resource](/rest/api/iotoperations/broker/create-or-update), and set the `generateResourceLimits.cpu` field to `Disabled`. For example:
346+
Prepare a Broker configuration file in JSON format, which includes the desired properties of the [Resource Manager `microsoft.iotoperations/instances/brokers` resource](/rest/api/iotoperations/broker/create-or-update), and set the `generateResourceLimits.cpu` field. For example, to enable CPU resource limits:
347+
348+
```json
349+
{
350+
"generateResourceLimits": {
351+
"cpu": "Enabled"
352+
}
353+
}
354+
```
355+
356+
Or to disable CPU resource limits:
288357

289358
```json
290359
{

0 commit comments

Comments
 (0)