Introduction ApsaraMQ for MQTT and provides suggestions on product selection in actual scenarios.
Background information
Traditional message-oriented middleware, such as ApsaraMQ for RocketMQ and MQ for Kafka are intended for microservices, big data, and other fields, and are responsible for the storage and forwarding of messages. The Message producer and consumer are both applications on servers.
Traditional MOM is applicable in scenarios where user services deployed on ECS instances adopt fixed technology stacks and language platforms. However, traditional MOM cannot deal with scenarios with access by massive multi-platform devices developed in multiple languages, where service properties play an important role during message production and consumption. Examples are the mobile Internet and IoT scenarios.
Adhering to the principle of single responsibility, ApsaraMQ for MQTT it is designed as a stateless gateway for the mobile Internet and IoT fields. It is only concerned with the access, management, and message transmission of massive mobile devices, and the storage of message data will be routed to backend storage products, such as the traditional message middleware. ApsaraMQ for RocketMQ And MQ for Kafka edition.
With this division of responsibilities, terminal send messages to ApsaraMQ for MQTT after that, the message will be based on ApsaraMQ for MQTT the bound storage products are routed to the specified products, and cloud applications can still maintain the traditional microservice development solution, and can interact with terminal by connecting to the cloud storage products. ApsaraMQ for MQTT This enables data interoperability.
Scenario comparison
A service scenario may include different types of application components, each of which plays a different role. Therefore, when selecting a solution, you must first understand ApsaraMQ for MQTT and traditional message-oriented middleware (MOM). They can be properly used together, for example, for sending and receiving messages of component A. ApsaraMQ for MQTT, the message sending and receiving of component B use ApsaraMQ for RocketMQ.
The following describes the problem based on scenarios. ApsaraMQ for MQTT Compared with traditional message-oriented middleware, traditional message-oriented middleware ApsaraMQ for RocketMQ take Alibaba Cloud MQ for Kafka and AMQP(RabbitMQ) for example.
| Service | Scenario |
|---|---|
ApsaraMQ for MQTT | AliwareMQ for IoT is applicable in mobility scenarios with access by massive devices, each of which maintains a relatively small data volume. Therefore, ApsaraMQ for MQTT suitable for scenarios where there are a large number of online clients (many enterprises have tens of thousands of and even millions of devices) but each client receives a relatively small message. |
| ApsaraMQ for RocketMQ | RocketMQ is a messaging engine that is oriented towards user services deployed on ECS instances and mainly used for decoupling, asynchronous notification, and load shifting between service components. It is applicable in scenarios with a relatively small number of ECS instances that need to process massive messages and require high throughput. In general, only a few enterprises operate more than 10,000 ECS instances. Therefore, ApsaraMQ for RocketMQ DRDs is applicable to scenarios where massive data processing and analysis are performed on log service. |
Scenarios of use of AliwareMQ for IoT and RocketMQ together
- Scenario 1
In the IoT scenario, thousands of (or even millions of) of device sensors can use ApsaraMQ for MQTT to upload data to a server (that is, an application deployed on the server), perform data analysis by using the ApsaraMQ for RocketMQ complete data analysis and processing.
- Scenario 2
On the Internet of Vehicles (IoV), you may need to upload vehicle information about millions of vehicles to the cloud (ECS instances), while the cloud delivers commands to any specific vehicles or broadcasts commands to all vehicles. The vehicle can be connected through the MQTT SDK ApsaraMQ for MQTT to report data and receive commands, the monitoring system (data analysis system) can ApsaraMQ for RocketMQ SDK to subscribe to messages and issue commands. The following figures show error messages.
Figure 1. Comparison chart 
Based on the above differences, it is recommended that you use on mobile devices. ApsaraMQ for MQTT, while in server applications use ApsaraMQ for RocketMQ (Or other message products).
Comparison of features
ApsaraMQ for MQTT And ApsaraMQ for RocketMQ the specific features of maxcompute are compared as follows:
| Features | ApsaraMQ for MQTT | ApsaraMQ for RocketMQ |
|---|---|---|
| Client connections | AliwareMQ for IoT supports message processing for massive clients, which reach millions or tens of millions in quantity. | RocketMQ supports message processing for a relatively small number of servers, generally less than 10,000 in quantity. |
| Message volume per client | Each MQTT client processes a small number of messages, and sends and receives messages at regular intervals. | Each MQTT client processes a large number of messages and requires high throughput. |
| Deployment | Mobile devices, app software, and H5 pages | Server-side applications |
| Consumption mode | Broadcasting consumption | Supported Clustering consumption and broadcasting consumption |
| Sequence | Messages can be sent in order but cannot be received in order (which will be available in the future). | Messages can be sent and received in order. |
| Multi-language/system support (TCP) | Supports multiple programming languages and systems, such as Java, C, C ++,. NET, Android, iOS, Python, JS, and Go. | Supports the Java, C ++, and. NET programming languages |
| Access credential | Supported Grant permissions to RAM users and an MQTT Token. For more information, see Authentication overview. | Supported Grant permissions to RAM users and Grant permissions across Alibaba Cloud accounts by using a RAM role (STS temporary access authorization) |
Model selection instructions
The general principle of model selection is as follows:
- We recommend that you use ApsaraMQ for RocketMQ access.
- For applications deployed on mobile terminals, apps, or browser pages, we recommend that you use ApsaraMQ for MQTT access.
For common application scenarios, the recommended ApsaraMQ for MQTT and ApsaraMQ for RocketMQ the selection is as follows:
| Scenario | Deployment | ApsaraMQ for MQTT | ApsaraMQ for RocketMQ |
|---|---|---|---|
| Status data reporting by devices | Mobile device | √ | Not supported |
| Receiving, processing, and analysis of device-reported data | Mobile device | Not supported | √ |
| Delivery of control commands to multiple devices | The Server tab | Not supported | √ |
| Live broadcasting, bullet screen, chat apps that require sending and receiving messages | Application | √ | Not supported |
| Receiving and analysis of chat messages on the MQTT broker | The Server tab | Not supported | √ |
√ indicates that the MQ service is recommended, whereas × indicates that the MQ service is not recommended.