参考 - IoT 中心配额和限制Reference - IoT Hub quotas and throttling

配额和限制Quotas and throttling

每个 Azure 订阅最多可以有 50 个 IoT 中心和 1 个免费中心。Each Azure subscription can have at most 50 IoT hubs, and at most 1 Free hub.

每个 IoT 中心都在特定层中预配了特定单位数。Each IoT hub is provisioned with a certain number of units in a specific tier. 层和单位数决定了可以发送的消息的每日配额上限。The tier and number of units determine the maximum daily quota of messages that you can send. 用于计算每日配额的消息大小为 0.5 KB(适用于中心的免费层)和 4 KB(适用于所有其他层)。The message size used to calculate the daily quota is 0.5 KB for a free tier hub and 4KB for all other tiers. 有关详细信息,请参阅 [Azure IoT 中心定价][lnk-pricing]。For more information, see [Azure IoT Hub Pricing][lnk-pricing].

层还决定了 IoT 中心对所有操作强制实施的限制。The tier also determines the throttling limits that IoT Hub enforces on all operations.

操作限制Operation throttles

操作限制是在分钟范围内应用的速率限制,主要是为了防止不当使用。Operation throttles are rate limitations that are applied in minute ranges and are intended to prevent abuse. 它们还受流量整形的约束。They're also subject to traffic shaping.

下表显示了强制限制。The following table shows the enforced throttles. 值与单个中心相关。Values refer to an individual hub.

限制Throttle 免费、B1 和 S1Free, B1, and S1 B2 和 S2B2 and S2 B3 和 S3B3 and S3
标识注册表操作(创建、检索、列出、更新、删除)Identity registry operations (create, retrieve, list, update, delete) 1.67/秒/单位(100/分钟/单位)1.67/sec/unit (100/min/unit) 1.67/秒/单位(100/分钟/单位)1.67/sec/unit (100/min/unit) 83.33/秒/单位(5,000/分钟/单位)83.33/sec/unit (5,000/min/unit)
新设备连接(此限制适用于建立_新连接_的速率,而不是连接总数)New device connections (this limit applies to the rate of new connections, not the total number of connections) 高于 100/秒或 12/秒/单位Higher of 100/sec or 12/sec/unit
例如,两个 S1 单位是 2*12 = 24 个新连接/秒,但你的单位至少有 100 个新连接/秒。For example, two S1 units are 2*12 = 24 new connections/sec, but you have at least 100 new connections/sec across your units. 如果有 9 个 S1 单位,则你的单位就有 108 个新连接/秒 (9*12)。With nine S1 units, you have 108 new connections/sec (9*12) across your units.
120 个新连接/秒/单位120 new connections/sec/unit 6,000 个新连接/秒/单位6,000 new connections/sec/unit
设备到云的发送Device-to-cloud sends 高于 100/秒或 12/秒/单位Higher of 100/sec or 12/sec/unit
例如,两个 S1 单位是 2*12 = 24/秒,但是在所有单位中至少有 100/秒。For example, two S1 units are 2*12 = 24/sec, but you have at least 100/sec across your units. 如果有 9 个 S1 单位,则所有单位就有 108/秒 (9*12)。With nine S1 units, you have 108/sec (9*12) across your units.
120/秒/单位120/sec/unit 6,000/秒/单位6,000/sec/unit
云到设备的发送1Cloud-to-device sends1 1.67/秒/单位(100/分钟/单位)1.67/sec/unit (100/min/unit) 1.67/秒/单位(100/分钟/单位)1.67/sec/unit (100/min/unit) 83.33/秒/单位(5,000/分钟/单位)83.33/sec/unit (5,000/min/unit)
云到设备的接收1Cloud-to-device receives1
(仅当设备使用 HTTPS 时)(only when device uses HTTPS)
16.67/秒/单位(1,000/分钟/单位)16.67/sec/unit (1,000/min/unit) 16.67/秒/单位(1,000/分钟/单位)16.67/sec/unit (1,000/min/unit) 833.33/秒/单位(50,000/分钟/单位)833.33/sec/unit (50,000/min/unit)
文件上传File upload 1.67 文件上传通知/秒/单位(100/分钟/单位)1.67 file upload notifications/sec/unit (100/min/unit) 1.67 文件上传通知/秒/单位(100/分钟/单位)1.67 file upload notifications/sec/unit (100/min/unit) 83.33 文件上传通知/秒/单位(5,000/分钟/单位)83.33 file upload notifications/sec/unit (5,000/min/unit)
直接方法1Direct methods1 160KB/秒/单位2160KB/sec/unit2 480KB/秒/单位2480KB/sec/unit2 24MB/秒/单位224MB/sec/unit2
查询Queries 20/分钟/单位20/min/unit 20/分钟/单位20/min/unit 1,000/分钟/单位1,000/min/unit
孪生(设备和模块)读取1Twin (device and module) reads1 100/秒100/sec 高于 100/秒或 10/秒/单位Higher of 100/sec or 10/sec/unit 500/秒/单位500/sec/unit
孪生更新(设备和模块)1Twin updates (device and module)1 50/秒50/sec 高于 50/秒或 5/秒/单位Higher of 50/sec or 5/sec/unit 250/秒/单位250/sec/unit
作业操作1Jobs operations1
(创建、更新、列表、删除)(create, update, list, delete)
1.67/秒/单位(100/分钟/单位)1.67/sec/unit (100/min/unit) 1.67/秒/单位(100/分钟/单位)1.67/sec/unit (100/min/unit) 83.33/秒/单位(5,000/分钟/单位)83.33/sec/unit (5,000/min/unit)
作业设备操作1Jobs device operations1
(更新孪生、调用直接方法)(update twin, invoke direct method)
10/秒10/sec 高于 10/秒或 1/秒/单位Higher of 10/sec or 1/sec/unit 50/秒/单位50/sec/unit
配置和 Edge 部署1Configurations and edge deployments1
(创建、更新、列表、删除)(create, update, list, delete)
0.33/秒/单位(20/分钟/单位)0.33/sec/unit (20/min/unit) 0.33/秒/单位(20/分钟/单位)0.33/sec/unit (20/min/unit) 0.33/秒/单位(20/分钟/单位)0.33/sec/unit (20/min/unit)
设备流启动率1Device stream initiation rate1 5 个新流/秒5 new streams/sec 5 个新流/秒5 new streams/sec 5 个新流/秒5 new streams/sec
最大并发连接设备流数1Maximum number of concurrently connected device streams1 5050 5050 5050
最大设备流数据传输1(每日聚合量)Maximum device stream data transfer1 (aggregate volume per day) 300 MB300 MB 300 MB300 MB 300 MB300 MB

1此功能在 IoT 中心的基本层内不可用。1This feature is not available in the basic tier of IoT Hub. 有关详细信息,请参阅如何选择正确的 IoT 中心For more information, see How to choose the right IoT Hub.
2限制计量大小为 4 KB。2Throttling meter size is 4 KB.

流量整形Traffic shaping

为了应对突发流量,IoT 中心可在有限的一段时间内接受超出限制的请求。To accommodate burst traffic, IoT Hub accepts requests above the throttle for a limited time. 其中的前几个请求会立即得到处理。The first few of these requests are processed immediately. 但是,如果请求数持续违反限制,IoT 中心会开始将请求放入队列,并以限制速率对其进行处理。However, if the number of requests continues violate the throttle, IoT Hub starts placing the requests in a queue and processed at the limit rate. 此效应称为“流量整形”。This effect is called traffic shaping. 此外,此队列的大小受到限制。Furthermore, the size of this queue is limited. 如果违反限制的情况持续出现,队列最终将会填满,而 IoT 中心会开始拒绝请求并引发 429 ThrottlingExceptionIf the throttle violation continues, eventually the queue fills up, and IoT Hub starts rejecting requests with 429 ThrottlingException.

例如,如果你使用模拟设备每秒将 200 条设备到云的消息发送到 S1 IoT 中心(它限制为每秒发送 100 条 D2C 消息)。For example, you use a simulated device to send 200 device-to-cloud messages per second to your S1 IoT Hub (which has a limit of 100/sec D2C sends). 在前一两分钟,消息会立即得到处理。For the first minute or two, the messages are processed immediately. 但是,由于设备发送的消息数持续超过限制,IoT 中心随后将每秒处理 100 条消息,并将剩余的消息放入队列。However, since the device continues to send more messages than the throttle limit, IoT Hub begins to only process 100 messages per second and puts the rest in a queue. 此时你会注意到延迟增大。You start noticing increased latency. 最终,在队列填满后,你会开始收到 429 ThrottlingException,并且 IoT 中心指标中的“限制错误数”会开始增加。Eventually, you start getting 429 ThrottlingException as the queue fills up, and the "number of throttle errors" in IoT Hub's metrics starts increasing.

标识注册表操作限制Identity registry operations throttle

设备标识注册表操作用于设备管理与预配方案中的运行时使用。Device identity registry operations are intended for run-time use in device management and provisioning scenarios. 通过导入和导出作业可以支持读取或更新大量的设备标识。Reading or updating a large number of device identities is supported through import and export jobs.

设备连接限制Device connections throttle

“设备连接”限制控制与 IoT 中心建立新设备连接的速率。The device connections throttle governs the rate at which new device connections can be established with an IoT hub. “设备连接”限制不控制同时连接的最大设备数。The device connections throttle does not govern the maximum number of simultaneously connected devices. 设备连接速率限制取决于为 IoT 中心预配的单位数。The device connections rate throttle depends on the number of units that are provisioned for the IoT hub.

例如,如果购买的是单一 S1 单位,则限制为每秒 100 个连接。For example, if you buy a single S1 unit, you get a throttle of 100 connections per second. 因此,若要连接 100,000 台设备,至少需要花费 1,000 秒(大约 16 分钟)。Therefore, to connect 100,,000 devices, it takes at least 1,000 seconds (approximately 16 minutes). 但是,同时连接的设备数可与用户在标识注册表中注册的设备数相同。However, you can have as many simultaneously connected devices as you have devices registered in your identity registry.

其他限制Other limits

IoT 中心强制实施其他操作限制:IoT Hub enforces other operational limits:

操作Operation 限制Limit
设备Devices 可以连接到单个 IoT 中心的设备的最大数目是 1,000,000。The maximum number of devices you can connect to a single IoT hub is 1,000,000. 只能联系 Microsoft 支持部门来提高此限制。The only way to increase this limit is to contact Microsoft Support.
文件上传 URIFile upload URIs 存储帐户一次可传出 10,000 个 SAS URI。10,000 SAS URIs can be out for a storage account at one time.
每台设备一次可传出 10 个 SAS URI。10 SAS URIs/device can be out at one time.
作业1Jobs1 最大并发作业数为 1(对于“免费”层和 S1)、5(对于 S2)和 10(对于 S3)。Maximum concurrent jobs is 1 (for Free and S1), 5 (for S2), and 10 (for S3). 但是,所有层的最大并发设备导入/导出作业数为 1。However, the max concurrent device import/export jobs is 1 for all tiers.
作业历史记录最多保留 30 天。Job history is retained up to 30 days.
额外终结点Additional endpoints 付费 SKU 中心可能有 10 个额外终结点。Paid SKU hubs may have 10 additional endpoints. 免费 SKU 中心可能有 1 个额外终结点。Free SKU hubs may have one additional endpoint.
消息路由规则Message routing rules 付费 SKU 中心可能有 100 条路由规则。Paid SKU hubs may have 100 routing rules. 免费 SKU 中心可包含 5 条路由规则。Free SKU hubs may have five routing rules.
设备到云的消息传送Device-to-cloud messaging 最大消息大小 256 KBMaximum message size 256 KB
云到设备的消息传递1Cloud-to-device messaging1 最大消息大小为 64 KB。Maximum message size 64 KB. 进行传递的最大挂起消息数为 50。Maximum pending messages for delivery is 50.
直接方法1Direct method1 直接方法有效负载的最大大小为 128 KB。Maximum direct method payload size is 128 KB.
自动设备配置1Automatic device configurations1 每个付费 SKU 中心 100 个配置。100 configurations per paid SKU hub. 每个免费 SKU 中心 20 个配置。20 configurations per free SKU hub.
自动 Edge 部署1Automatic Edge deployments1 每个部署 20 个模块。20 modules per deployment. 每个付费 SKU 中心 100 个部署。100 deployments per paid SKU hub. 每个免费 SKU 中心 20 个部署。20 deployments per free SKU hub.
孪生1Twins1 每个孪生部分(标记、所需属性、报告的属性)的最大大小为 8 KBMaximum size per twin section (tags, desired properties, reported properties) is 8 KB

1此功能在 IoT 中心的基本层内不可用。1This feature is not available in the basic tier of IoT Hub. 有关详细信息,请参阅如何选择正确的 IoT 中心For more information, see How to choose the right IoT Hub.

提高配额或限制Increasing the quota or throttle limit

无论何时,都可通过增加 IoT 中心内的预配单位数来提高配额或限制。At any given time, you can increase quotas or throttle limits by increasing the number of provisioned units in an IoT hub.

延迟Latency

IoT 中心致力于降低所有操作的延迟。IoT Hub strives to provide low latency for all operations. 但是,由于网络条件和其他不可预测因素,它不能保证特定的延迟。However, due to network conditions and other unpredictable factors it cannot guarantee a certain latency. 在设计解决方案时,应该:When designing your solution, you should:

  • 避免对任何 IoT 中心操作的最大延迟进行假定。Avoid making any assumptions about the maximum latency of any IoT Hub operation.
  • 在离设备最近的 Azure 区域预配 IoT 中心。Provision your IoT hub in the Azure region closest to your devices.
  • 请考虑在设备上或在离设备近的网关上使用 Azure IoT Edge 执行易受延迟影响的操作。Consider using Azure IoT Edge to perform latency-sensitive operations on the device or on a gateway close to the device.

如前所述,多个 IoT 中心单位影响限制,但未提供任何附加延迟权益或保证。Multiple IoT Hub units affect throttling as described previously, but do not provide any additional latency benefits or guarantees. 如果发现操作延迟意外增加,请与 Microsoft 支持联系。If you see unexpected increases in operation latency, contact Microsoft Support.

后续步骤Next steps

此 IoT 中心开发人员指南中的其他参考主题包括:Other reference topics in this IoT Hub developer guide include: