Introduction to message queue RocketMQ help enterprise trading systems to withstand the impact of the instantaneous tens of millions of TPS and trillions of traffic peaks, and keep the messages between applications smooth? The following will introduce you to the "six weapons" of the message queue RocketMQ to cope with the traffic peaks of Double Eleven.

Author:

review & proofreading: years,

Editing & Typesetting: Wen Yan

"498.2 billion, 583,000 pens/sec" behind

Catalyzed by the new crown pneumonia epidemic, digital lifestyles have gradually become the new normal. "498.2 billion, 583,000 transactions per second" is an intuitive manifestation of the first-mover advantage and huge potential of the digital economy of the 2020 Tmall Double 11 Global Carnival (abbreviated as: Tmall Double 11).

1.png

In the face of tens of millions of concurrent and trillion-level traffic peaks, behind the strong support is the official designated product of the double eleven transaction core link: the message queue RocketMQ.

2.png

Double Eleven transaction scenario business pain points

As Double Eleven heats up year by year, ensuring the stability of the trading scene has become the key for all companies in the Double Eleven business. The early morning of the Double Eleven event each year is the day of "Wanmin Carnival", and it is also the trading system of various companies. When tested, ensuring the business processing capabilities of the core trading system and effectively responding to hundreds of thousands of transaction orders per second becomes the top priority. Failure to buffer traffic will directly lead to the collapse of these systems. The core "secret" to avoid system crashes is the message queue RocketMQ.

How does the message queue RocketMQ help various enterprise trading systems to withstand the impact of the instantaneous tens of millions of TPS and trillions of traffic peaks, and keep the messages between applications smooth? The following introduces you the "six weapons" of the message queue RocketMQ to cope with the traffic peaks of Double Eleven.

Message queue RocketMQ's "six weapons"

What problems will the traffic peak of Double Eleven bring to users and merchants' system business? How do the "six weapons" of the message queue RocketMQ solve these problems? The editor will take you to explore one or two:

Weapon 1: "Asynchronous Decoupling"

Background: the night of Double Eleven, when a user “pointed the country” on his mobile phone, he might have thought that behind a small shopping APP is actually a huge system. From the moment the user purchases the product, You have to deal with hundreds of business systems, and every transaction order data will be related to hundreds of downstream business systems, including logistics, shopping carts, points, direct charging, stream computing analysis, etc. The entire system is huge and complex. A slightly unreasonable architecture design will directly affect the continuity of the main site's business.

Faced with such a complex and huge system, to avoid the influence of mutual coupling between system services, the "asynchronous decoupling" function of the message queue RocketMQ is used, and the upstream and downstream business systems are loosely coupled through the message queue RocketMQ. The loose coupling can reduce The complexity of the system shortens the response time for user requests (compresses the sum of the time required for multiple steps to the time required for only one message), and ensures that the failure of a downstream subsystem does not affect the entire link.

3.png

Weapon 2: "Cut the peaks and fill the valleys"

Background: After dealing with the coupling problems caused by the huge system behind the transaction business, from the user's point of view, there were millions of users clicking to buy at the same time at 0:00 during Double Eleven. Pages, due to the massive amount of user requests, the traffic has surged. In the face of such a large amount of access traffic, the downstream notification system may not be able to carry the massive amount of calls, and may even cause problems such as system crashes and miss notifications.

To solve these problems, it is necessary to use the message queue RocketMQ's "peak-shaving and valley-filling" function. The message queue RocketMQ can be added between the application and the downstream notification system. RocketMQ supports high-concurrency message writing with low latency, and unlimited accumulation Ability to avoid the impact of ultra-high traffic and ensure the smooth and stable operation of downstream businesses within a safe water level.

4.png

Weapon 3: "Distributed Transaction Message"

background: from the previous introduction that the distributed processing of messages can be realized through asynchronous decoupling of messages. In the traditional distributed transaction processing method, the user creates a new order information, accompanied by this order For information changes, shopping carts, user tables, points, etc. in the entire business chain need to be changed. The system needs to use distributed transaction coordination components to ensure transaction consistency among multiple business calls. Traditional distributed transaction components pursue strong consistency, low performance throughput, and complex systems. How can we achieve distributed transactions without making the system too complicated?

At this time, the "distributed transaction message" function of the message queue RocketMQ plays a key role. Through the original lightweight order flow transaction coordination ability, only one message can be sent to achieve a distributed transaction with final consistency of the message. At the same time, ensure that the order status is persisted and the downstream calls are consistent.

5.png

Weapon 4: "Message Filtering"

background: through the above introduction will find that the process from the customer placing the order to the customer receiving the product will produce a series of messages, which can be divided into transaction messages, logistics messages, shopping cart messages, etc. according to the type of message. How to ensure various types of messages Effective delivery and accurate consumption?

At this time, you need to use the "message filtering" function of the message queue RocketMQ. You can define different attributes for different types of messages through Tag, and filter the messages according to the message attributes. Only the messages that meet the filter conditions will be delivered. Go to the consumer end for consumption. For example, define geographic attributes for logistics messages, which are divided into Hangzhou and Shanghai according to the region:

  • Order message
  • Logistics news
    • Logistics news and the location is Hangzhou
    • Logistics news and the location is Shanghai

6.png

Weapon Five: "Timed Messages"

Background: In addition to the problems that may occur in the above system levels, users themselves may have encountered some small details during the shopping process. For example, after clicking the purchase button, "Please complete the payment within 30 minutes" will appear. If you don’t pay for more than 30 minutes, the order will be closed automatically.

This business uses the "timed message" function of the message queue RocketMQ. The message queue RocketMQ can implement timed messages with custom second-level precision intervals, and trigger some timed tasks through messages, such as sending reminders to users at a fixed time. , And finally realize the central scheduling of massive order status changes overtime.

7.png

image.gif weapon six: "Sequential receiving and dispatching"

Background: During the Double 11 promotion, the buyer's business side and the transaction system itself will face many problems, and the seller side will also encounter some difficulties. For example, the buyer buys something, but the seller himself cannot see it.

In order to solve this problem, it is generally necessary to use the sequential message synchronization capability of the message queue to synchronize the change subscription of the buyer table to the seller table. At this time, relying on RocketMQ's hotspot-free, high-performance, and highly reliable sequence messages can ensure the sequence synchronization of database changes and ensure the synchronization of orders for buyers and sellers.

8.png

summary

Through the above introduction, I have taken you to understand the power of the six weapons of the message queue RocketMQ on the "battlefield" of Double Eleven. The "Double Eleven" war is about to start in 2021, and the message queue RocketMQ will protect your Double Eleven business. At the same time, the platinum version can provide 99.99% service availability and 99.99999999% data reliability. Contact us and look forward to accompany your business to "ride the wind and waves" in 2021 Double Eleven.

9.png

Copyright Statement: content of this article is contributed spontaneously by Alibaba Cloud real-name registered users. The copyright belongs to the original author. The Alibaba Cloud Developer Community does not own its copyright and does not assume corresponding legal responsibilities. For specific rules, please refer to the "Alibaba Cloud Developer Community User Service Agreement" and the "Alibaba Cloud Developer Community Intellectual Property Protection Guidelines". If you find suspected plagiarism in this community, fill in the infringement complaint form to report it. Once verified, the community will immediately delete the suspected infringing content.

阿里云开发者
3.2k 声望6.3k 粉丝

阿里巴巴官方技术号,关于阿里巴巴经济体的技术创新、实战经验、技术人的成长心得均呈现于此。


引用和评论

0 条评论