By Xuanchu
This article begins with how to deal with scheduling and delay problems in workflow and information distribution. Then, it compares several common solutions in the industry, such as the direct multi-thread coding, Spring timed scheduling framework, large-scale distributed scheduling framework, and message scheduling based on message-oriented middleware (MOM). MOM provides user-friendly APIs, features easy calling, and has stable performance, and therefore MOM is recommended for resolving the aforementioned problems. This article also compares the pros and cons of ActiveMQ, RabbitMQ, and RocketMQ in these scenarios.
To help you understand how to use MOM, we will introduce three common scenarios and the solutions. We will also describe the advantages of scheduled messages for RocketMQ. The features of scheduled messages will be extensively updated in the near future. The new version of scheduled messages has been running stably in Alibaba for nearly two years and will be available in the public cloud soon.
The demand for scheduled and delayed processing is ubiquitous in the processes of information distribution and business. We often encounter problems such as, what are the elegant ways to handle expected events and distribute defined information at a certain point of time in the future, and how to design scenarios and business logic with demanding timeline requirements. After comparing several commonly used technical solutions, I summarized them as follows, and each of them has its own pros and cons:
Direct Multi-thread Encoding | Spring Timed Scheduling Framework | Large-scale Distributed Scheduling Framework | Message Scheduling of MOM | |
---|---|---|---|---|
Advantages | Few | 1. The integration environment of Spring is developer-friendly.2. Its APIs and annotations are developer-friendly.3. It is suitable for standalone scenarios. | 1. It is dedicated to scenarios of distributed scheduling processing.2. It makes full use of business machine resources to run scheduling tasks.3. It has been proven in large-scale traffic scenarios and can provide high availability. | 1. Its APIs are developer-friendly.2. It supports "scheduled" and "delayed" scenarios.3. It performs well in large-scale distribution scenarios. |
Disadvantages | 1. It adopts multi-thread coding and is prone to errors.2. Its reinvention idea does not conform to the development principle.3. The program is complicated and difficult to maintain. | 1. It is suitable for standalone scenarios, because the additional distributed lock problem must be solved in distributed environments.2. It is suitable for scheduled scenarios, because the delay function cannot be implemented to support delayed scenarios. | 1. It is not opened-source or commercially available as a standalone product.2. It is suitable for scheduled scenarios, because the delay function cannot be implemented to support delayed scenarios. | Sharding is unavailable for scheduled tasks. |
MOM provides developer-friendly API design and supports agile development, allowing developers to efficiently integrate and develop APIs. It supports both "scheduled" and "delayed" scenarios, and provides high performance and availability for large-scale distributed business scenarios. On the whole, MOM is more convenient to use.
Do these features perform differently in different MOMs? First, let's take a look at what features are required for an excellent scheduled or delayed MOM.
According to the preceding analysis, let's compare some popular MOM products in the industry. Among the current mainstream message systems, ActiveMQ, RabbitMQ, and RocketMQ can all provide scheduled message functions. However, the scheduling performance of ActiveMQ is about 300 transactions per second (TPS), which is only suitable for small-scale scenarios. RabbitMQ provides a scheduling plug-in with a performance of about 2,000 TPS. However, it does not support high availability and mass message accumulation.
The new version of RocketMQ scheduled message function incorporates the advantages of different major scheduled message components, and makes up for the limitations in the design of other components. Therefore, it supports more scheduled and delayed scenarios.
Let's see how they perform in real-life scenarios. Let's take a brief look at several typical scheduled and delayed scenarios, which are implemented by using RocketMQ scheduled messages.
Now, let's look at the concepts of scheduled messages and delayed messages in RocketMQ. Based on the user perspective and experience, messages can be divided into scheduled messages and delayed messages.
For instructions, visit the official website
Message Queue for RocketMQ provides hierarchical delayed messages. It features high performance and accumulates messages without limits for high availability. It also supports scheduling within seconds to achieve highly precise mass storage.
In various businesses and promotional scenarios in the Alibaba economy, RocketMQ scheduled messages have been widely used and have withstood numerous traffic peaks and stability tests. RocketMQ has become the stable scheduled message system that leads the industry.
As a top-level Apache project, RocketMQ has built a complete technical ecosystem. With multi-language and multi-protocol support, its scheduled messages naturally inherit the advantages of top-level projects and feature a complete technical ecology.
Alibaba Cloud focuses on cloud computing, and RocketMQ continues to evolve along with the technical architecture of Alibaba Cloud. While providing technical facilities, our strong technical teams are also providing professional technical support for customers who are using RocketMQ.
In the new version of the scheduled message function, the kernel layer architecture is deeply optimized, the design principles and functional implementations are significantly upgraded and tuned, and the architecture of scheduled messages is fundamentally renovated. The new version greatly improves the stability and performance of scheduled messages.
Demystify New Features of RocketMQ and Its Practices in Financial Scenarios
206 posts | 12 followers
FollowOpenAnolis - May 8, 2023
Apache Flink Community China - July 3, 2023
Apache Flink Community China - July 28, 2020
Alibaba Cloud Serverless - July 14, 2023
Alibaba Cloud Native Community - July 13, 2022
Alibaba Cloud Serverless - April 21, 2022
206 posts | 12 followers
FollowApsaraMQ for RocketMQ is a distributed message queue service that supports reliable message-based asynchronous communication among microservices, distributed systems, and serverless applications.
Learn MoreA distributed, fully managed, and professional messaging service that features high throughput, low latency, and high scalability.
Learn MoreA message service designed for IoT and mobile Internet (MI).
Learn MoreA fully-managed Apache Kafka service to help you quickly build data pipelines for your big data analytics.
Learn MoreMore Posts by Alibaba Cloud Native