选择适用于解决方案的 IoT 中心层Choose the right IoT Hub tier for your solution

每个 IoT 解决方案都是不同的,因此 Azure IoT 中心会根据定价和缩放提供多个选项。Every IoT solution is different, so Azure IoT Hub offers several options based on pricing and scale. 本文旨在介绍如何评估 IoT 中心需求。This article is meant to help you evaluate your IoT Hub needs. 有关 IoT 中心层的定价信息,请参阅 IoT 中心定价For pricing information about IoT Hub tiers, see IoT Hub pricing.

若要确定哪个 IoT 中心层适用于解决方案,请向自己提问两个问题:To decide which IoT Hub tier is right for your solution, ask yourself two questions:

我计划使用哪些功能?What features do I plan to use? Azure IoT 中心提供两个层,即基本层和标准层,这两个层在所支持的功能数目上有所不同。Azure IoT Hub offers two tiers, basic and standard, that differ in the number of features they support. 如果 IoT 解决方案需要先从设备收集数据,然后再集中进行分析,则可能适合使用基本层。If your IoT solution is based around collecting data from devices and analyzing it centrally, then the basic tier is probably right for you. 如果需要使用更高级的配置来远程控制 IoT 设备,或者需要将某些工作负荷分发到设备本身,则应考虑标准层。If you want to use more advanced configurations to control IoT devices remotely or distribute some of your workloads onto the devices themselves, then you should consider the standard tier. 若要详细了解每一层中包括哪些功能,请转到基本层和标准层For a detailed breakdown of which features are included in each tier continue to Basic and standard tiers.

我计划每天移动多少数据?How much data do I plan to move daily? 每个 IoT 中心层提供三种大小,具体取决于每天能够处理的数据吞吐量。Each IoT Hub tier is available in three sizes, based around how much data throughput they can handle in any given day. 这些大小以数字的形式标为 1、2、3。These sizes are numerically identified as 1, 2, and 3. 例如,1 级 IoT 中心的每个单元每天可以处理 40 万条消息,而 3 级单元则可以处理 3 亿条消息。For example, each unit of a level 1 IoT hub can handle 400 thousand messages a day, while a level 3 unit can handle 300 million. 有关数据准则的更多详细信息,请转到消息吞吐量For more details about the data guidelines, continue to Message throughput.

基本层和标准层Basic and standard tiers

IoT 中心的标准层启用了所有功能,是任何需要使用双向通信功能的 IoT 解决方案所必需的。The standard tier of IoT Hub enables all features, and is required for any IoT solutions that want to make use of the bi-directional communication capabilities. 基本层启用了部分功能,适用于只需单向通信(从设备到云)的 IoT 解决方案。The basic tier enables a subset of the features and is intended for IoT solutions that only need uni-directional communication from devices to the cloud. 这两个层提供相同的安全性和身份验证功能。Both tiers offer the same security and authentication features.

每个 IoT 中心在每个层内只能选择一种类型的版本Only one type of edition within a tier can be chosen per IoT Hub. 例如,可以创建具有多个 S1 单元的 IoT 中心,但不能创建混合使用不同版本的单元,例如 S1 和 B3,或者 S1 和 S2。For example, you can create an IoT Hub with multiple units of S1, but not with a mix of units from different editions, such as S1 and B3, or S1 and S2.

功能Capability 基本层Basic tier 免费/标准层Free/Standard tier
设备到云的遥测Device-to-cloud telemetry Yes Yes
每设备标识Per-device identity Yes Yes
消息路由Message routing Yes Yes
HTTP、AMQP 和 MQTT 协议HTTP, AMQP, and MQTT protocols Yes Yes
设备预配服务Device Provisioning Service Yes Yes
监视和诊断Monitoring and diagnostics Yes Yes
云到设备的消息传递Cloud-to-device messaging Yes
设备孪生模块孪生设备管理Device twins, Module twins, and Device management Yes
Azure IoT EdgeAzure IoT Edge Yes

IoT 中心还提供一个免费层,用于测试和评估。IoT Hub also offers a free tier that is meant for testing and evaluation. 它具有标准层的所有功能,但消息传递有限额。It has all the capabilities of the standard tier, but limited messaging allowances. 不能从免费层升级到基本层或标准层。You cannot upgrade from the free tier to either basic or standard.

分区Partitions

Azure IoT 中心包含 Azure 事件中心的许多核心组件,包括分区Azure IoT Hubs contain many core components of Azure Event Hubs, including Partitions. IoT 中心的事件流通常由各种 IoT 设备报告的传入遥测数据进行填充。Event streams for IoT Hubs are generally populated with incoming telemetry data that is reported by various IoT devices. 事件流的分区功能用来减少当事件流有并发的读取和写入时发生的连接。The partitioning of the event stream is used to reduce contentions that occur when concurrently reading and writing to event streams.

分区限制是在创建 IoT 中心时选择的,并且无法更改。The partition limit is chosen when IoT Hub is created, and cannot be changed. 基本层 IoT 中心和标准层 IoT 中心的最大分区限制为 32。The maximum partition limit for basic tier IoT Hub and standard tier IoT Hub is 32. 大多数 IoT 中心只需要 4 个分区。Most IoT hubs only need 4 partitions. 有关确定分区的详细信息,请参阅事件中心常见问题解答我需要多少分区?For more information on determining the partitions, see the Event Hubs FAQ How many partitions do I need?

层升级Tier upgrade

创建 IoT 中心以后,即可从基本层升级到标准层,不需中断现有的操作。Once you create your IoT hub, you can upgrade from the basic tier to the standard tier without interrupting your existing operations. 有关详细信息,请参阅如何升级 IoT 中心For more information, see How to upgrade your IoT hub.

从基本层迁移到标准层时,分配配置保持不变。The partition configuration remains unchanged when you migrate from basic tier to standard tier.

IoT 中心 REST APIIoT Hub REST APIs

IoT 中心基本层和标准层所支持的功能存在差异,也就是说,某些 API 调用在基本层中心不适用。The difference in supported capabilities between the basic and standard tiers of IoT Hub means that some API calls do not work with basic tier hubs. 下表显示了哪些 API 可用:The following table shows which APIs are available:

APIAPI 基本层Basic tier 免费/标准层Free/Standard tier
删除设备Delete device Yes Yes
获取设备Get device Yes Yes
删除模块Delete module Yes Yes
获取模块Get module Yes Yes
获取注册表统计信息Get registry statistics Yes Yes
获取服务统计信息Get services statistics Yes Yes
创建或更新设备Create Or Update Device Yes Yes
放置模块Put module Yes Yes
查询 IoT 中心Query IoT Hub Yes Yes
查询模块Query modules Yes Yes
创建文件上传 SAS URICreate file upload SAS URI Yes Yes
接收发往设备的通知Receive device bound notification Yes Yes
发送设备事件Send device event Yes Yes
发送模块事件Send module event Yes Yes
更新文件上传状态Update file upload status Yes Yes
批量设备操作Bulk device operation 是的,IoT Edge 功能除外Yes, except for IoT Edge capabilities Yes
清除命令队列Purge command queue Yes
获取设备孪生Get device twin Yes
获取模块孪生Get module twin Yes
调用设备方法Invoke device method Yes
更新设备孪生Update device twin Yes
更新模块孪生Update module twin Yes
放弃发往设备的通知Abandon device bound notification Yes
完成发往设备的通知Complete device bound notification Yes
取消作业Cancel job Yes
创建作业Create job Yes
获取作业Get job Yes
查询作业Query jobs Yes

消息吞吐量Message throughput

若要基于每个单位评估流量,最佳方式是调整 IoT 中心解决方案的大小。The best way to size an IoT Hub solution is to evaluate the traffic on a per-unit basis. 尤其要考虑以下类别的操作所需的高峰吞吐量:In particular, consider the required peak throughput for the following categories of operations:

  • 设备到云的消息Device-to-cloud messages
  • 云到设备的消息Cloud-to-device messages
  • 标识注册表操作Identity registry operations

流量按单元而不是中心来度量。Traffic is measured on a per-unit basis, not per hub. 1 级或 2 级 IoT 中心实例最多可以有 200 个与之关联的单元。A level 1 or 2 IoT Hub instance can have as many as 200 units associated with it. 3 级 IoT 中心实例最多可以有 10 个单元。A level 3 IoT Hub instance can have up to 10 units. 创建 IoT 中心以后,即可更改单元数,或者在特定层的不同大小(1、2、3)之间切换,而不会中断现有的操作。Once you create your IoT hub you can change the number of units or move between the 1, 2, and 3 sizes within a specific tier without interrupting your existing operations. 有关详细信息,请参阅如何升级 IoT 中心For more information, see How to upgrade your IoT Hub.

例如,就每个层的流量功能来说,设备到云的消息遵循以下持续吞吐量指导原则:As an example of each tier's traffic capabilities, device-to-cloud messages follow these sustained throughput guidelines:

Tier 持续吞吐量Sustained throughput 持续发送速率Sustained send rate
B1、S1B1, S1 每个单元最多 1111 KB/分钟Up to 1111 KB/minute per unit
(1.5 GB/天/单元)(1.5 GB/day/unit)
每个单元平均 278 条消息/分钟Average of 278 messages/minute per unit
(400000 条消息/天/单元)(400,000 messages/day per unit)
B2、S2B2, S2 每个单元最多 16 MB/分钟Up to 16 MB/minute per unit
(22.8 GB/天/单元)(22.8 GB/day/unit)
每个单元平均 4,167 条消息/分钟Average of 4,167 messages/minute per unit
(600 万条消息/天/单元)(6 million messages/day per unit)
B3、S3B3, S3 每个单元最多 814 MB/分钟Up to 814 MB/minute per unit
(1144.4 GB/天/单元)(1144.4 GB/day/unit)
每个单元平均 208,333 条消息/分钟Average of 208,333 messages/minute per unit
(3 亿条消息/天/单元)(300 million messages/day per unit)

除了此吞吐量信息,另请参阅 IoT 中心配额和限制,并相应地设计解决方案。In addition to this throughput information, see IoT Hub quotas and throttles and design your solution accordingly.

标识注册表操作吞吐量Identity registry operation throughput

由于大多数 IoT 中心标识注册表操作都与设备预配相关,因此不认为这些操作是运行时操作。IoT Hub identity registry operations are not supposed to be run-time operations, as they are mostly related to device provisioning.

有关具体的突发性能数字,请参阅 IoT 中心配额和限制For specific burst performance numbers, see IoT Hub quotas and throttles.

自动缩放Auto-scale

如果即将达到 IoT 中心允许的消息限制,可以使用这些用于自动缩放的步骤在同一 IoT 中心层内增加一个 IoT 中心单元。If you are approaching the allowed message limit on your IoT Hub, you can use these steps to automatically scale to increment an IoT Hub unit in the same IoT Hub tier.

分片Sharding

尽管单个 IoT 中心可以扩展到数百万个设备,但有时解决方案所需的具体性能特征无法由单个 IoT 中心提供保证。While a single IoT hub can scale to millions of devices, sometimes your solution requires specific performance characteristics that a single IoT hub cannot guarantee. 在这种情况下,可以跨多个 IoT 中心将设备分区。In that case, you can partition your devices across multiple IoT hubs. 多个 IoT 中心可以缓解流量喷发,并获得所需的吞吐量或操作速率。Multiple IoT hubs smooth traffic bursts and obtain the required throughput or operation rates that are required.

后续步骤Next steps