Looking for RocketMQ Chief Evaluation Officer [Alibaba Cloud Product Evaluation]

Preface

2023-8-28 19:46:38

The following content is sourced from "[Alibaba Cloud Product Review]"
and is for learning and communication purposes only.

copyright

Delete the following words when publishing on other platforms.
This article was first published on the CSDN platform.
The author is CSDN@日星月云.
The homepage of the blog is https://blog.csdn.net/qq_51625007.
Delete the above words when publishing on other platforms.

recommend

RocketMQ review

Looking for RocketMQ Chief Review Officer

Event homepage
https://developer.aliyun.com/mission/review/rocketmqtest

Operation homepage
https://developer.aliyun.com/topic/rocketmq

start

2. Trial tutorial:

STEP01: Create VPC: Click to view the operation document

STEP02: Receive resources: Click to view the video tutorial

3. Scene introduction:

1. Ordinary message scenario: Among various message types, ordinary messages are the simplest and most important. Ordinary messages are the basic message types of RocketMQ, providing high-throughput, scalable, low-latency, and asynchronous communication capabilities.

2. Timed message scenario: Timed message means that after the producer sends a message to the message queue, he does not expect that the message will be consumed by the consumer immediately, but expects that the consumer can consume it at a specified time.

3. Transaction message scenario: There is a common problem in distributed system call scenarios, that is, while executing a core business logic, multiple downstream businesses need to be called for business processing, and multiple downstream businesses and the current core business must be Success or failure at the same time, thereby avoiding the inconsistency of partial success and failure. Simply put, the "transaction" in the message queue mainly solves the problem of data consistency between message producers and consumers.

4. Sequential message scenario: For a specified Topic, messages of the same MessageGroup are published and consumed according to the strict first-in-first-out (FIFO) principle, that is, messages published first are consumed first, and messages published later are consumed later. The server strictly follows Send order for storage and consumption.

5. Message accumulation scenario: Message accumulation means that due to the limited consumption capacity of consumers, all messages cannot be consumed correctly in a short period of time. At this time, the status of unconsumed messages is saved on the server. In RocketMQ, message accumulation can be measured through Metrics indicators, which can directly reflect the processing rate and accumulation of messages in the queue.

6. Message failure re-delivery scenario: When a consumer fails to consume a message, RocketMQ will re-deliver the message according to the maximum number of retries for failure recovery. In cluster mode, the consumption business logic code will return a consumption failure status or throw an exception. If a message fails to be consumed, it will be retried according to the set maximum number of retries, and then the message will be discarded.

Task 1: Receive free resources

finish this
Insert image description here

Looking for RocketMQ Chief Review Officer: Operational Guidelines for Creating a Private Network VPC

https://vpc.console.aliyun.com/vpc/cn-hangzhou/vpcs

Insert image description here

Insert image description here
After creation is complete

Insert image description here

Insert image description here
There are these two, I painted it out,
click to use it immediately
Insert image description here
Insert image description here
, and it's done.

Task 2: Understand the evaluation activities

finish this

The new version is here

https://ons.console.aliyun.com/overview
Insert image description here

Click on the instance list

Insert image description here

Insert image description here

Click on Topic, this is 0

Insert image description here
topic management
Insert image description here

group management
Insert image description here

Return to topic management
and click on the message for one-click experience
Insert image description here

Insert image description here

Experience ordinary messaging scenarios

Ordinary messages are the most basic publish-subscribe model. Most businesses use ordinary messages for asynchronous decoupling.

Consumer group subscribes to topic

Insert image description here
Insert image description here

Enable function calculation and click to send a normal message

Insert image description here

Insert image description here

Here's what to create a character
Insert image description here
message track
Insert image description here

You can use the dashboard for troubleshooting, message management and other scenarios.

Experience sequential message scenarios

Sequential messages can be processed within a message group in a first-in, first-out manner. They
are used in scenarios that have extremely high requirements on message processing order, such as heterogeneous data replay synchronization.

Create topic
Insert image description here

Create group
Insert image description here

One click experience

First, you need to start the consumer instance and subscribe to this topic

Insert image description here

Insert image description here

Start the producer to send messages

Different from ordinary messages, sequential messages need to specify an additional message group, such as using the order ID as the message group. RocketMQ will process the messages in the same message group in a first-in, first-out manner when
consuming messages for the same order sequentially.

Insert image description here
Insert image description here

You can see that the message has been sent successfully, and messages from the same message group will enter the same consumer instance for serial consumption.

By designing a reasonable message group, high concurrency and high throughput can be achieved while preserving order.

Finally enter the dashboard to see our statistics

Experience the scheduled message scenario

Scheduled messages can realize the consumption process of triggering messages at specified times and can be used in scheduled event-driven architectures.

For example, if the order is not paid for 30 minutes after the order is created, the order will be canceled.

Create topic

Insert image description here
Create group

Insert image description here

One-click sending and receiving experience

First, you need to start a consumer instance to subscribe to the topic.

Insert image description here

Start another generator and send a message to this topic

Different from ordinary messages, scheduled messages need to specify a scheduled time

Insert image description here

Because it is a delayed message, it is not visible at first
Insert image description here
and needs to wait 20s.

Insert image description here

Consumers also made successful purchases

Finally, enter the dashboard to view statistics

Experience transaction message scenarios

Transaction messages enable producer transactions and consumer transactions to achieve eventual consistency

Generally used in scenarios such as transactions and payments that have higher requirements for distributed transactions.

Create topic
Insert image description here

Create group

Insert image description here

Messaging experience

Use the consumer group you just created to start a consumer instance and subscribe to this topic

Insert image description here

Start a generator and send a message

Insert image description here

Different from ordinary messages
, the generator of transaction messages also needs to implement a local transaction status reviewer
for exception compensation by the transaction coordinator RocketMQBroker. For detailed code, please see demo

Only after the producer's local transaction and the message are sent successfully at the same time, the message will be visible to the consumer.

Execute consumer transactions to ensure that producer transactions and consumer transactions reach eventual consistency

Finally, enter the dashboard to view statistics

Insert image description here

Experience the message accumulation scenario

Message accumulation is an abnormal scenario of messages

When a large amount of messages are consumed slowly or fail due to similar reasons, the speed of successful consumption continues to fail to keep up with the production speed.

There will be a accumulation of messages

This problem needs to be solved as soon as possible, otherwise a malfunction will occur

Create topic

Message accumulation has nothing to do with type. Here we choose to use ordinary messages.

Insert image description here

Create group

Insert image description here
After the resource is created, send and receive experience

Click on the template of consumption accumulation.
Insert image description here
Here, the generator will be simulated to send a large number of messages, and the consumer will continue to consume and time out.

Insert image description here

We can see that the volume of successfully produced messages gradually increases, much faster than the volume of successfully consumed messages.

At this time, accumulation has already occurred

To troubleshoot stacking problems, we need a global perspective, and the dashboard can provide a lot of help.

Through the dashboard, you can see the message production speed from the perspective of the producer.

Confirm whether the accumulation is caused by sudden message traffic or insufficient capacity.

Insert image description here

We can also see the message accumulation curve from the consumer perspective to evaluate the business impact that has been generated. We can also see the consumption time and success rate, and determine whether the accumulation is caused by slow consumers or due to consumption business errors. , and finally combine it with the actual code logic and running status to finally locate the root cause and solve the accumulation problem.

Insert image description here

Experience the message resubmission scenario

Message conflict, belonging to the abnormal flow of messages

After message consumption fails, the Broker will retry until the consumption is successful, or the number of consumption exceeds the retry threshold, in order to achieve reliable message services and the ultimate consistency of asynchronous links.

First, create a topic

All message types will be re-invested, so we choose to take ordinary messages as an example.
Insert image description here
After having the topic, we need to create a consumer group

Insert image description here

After the resource is created, send and receive experience

Click message repost template
Insert image description here

This will simulate the generator sending a message, and the consumer returns consumption failure.

We can see that after the first consumption fails, the Broker will reinvest after a certain period of time, and the reinvestment interval will gradually increase as the number of reinvestments increases, becoming longer and longer.

Insert image description here

Click on the message track and we can see the detailed reinvestment time and number of times

Insert image description here

Finally enter the dashboard to view statistics

Experience summary

One-click experience is indeed possible

The experience is pretty good

Very friendly to technical novices

1. Novice experience category:

1) How did you feel when you first used this scenario, and output the product usage process;

The first experience feels very good. You can see the link above for the usage process.

2) Through your experience of this scenario, what learning suggestions would you give to other users who are new to RocketMQ products.

Suggestions for students who are new to learning. You can learn about RocketMQ first. It will be better if you have used it.

I have also used RocketMQ before, transaction messages

2. Advanced experience categories, including but not limited to (choose at least two of them):

1) You have implemented the source code in this scene experience. What feelings do you have through understanding the source code?

Transaction messages

2) In what scenarios would you tend to use this function of RocketMQ, and what benefits or value will it bring to you or the company?

I think the difference between RocketMQ and other message queues is that it can send transaction messages

3) What do you think are the advantages of this scenario? And what are the areas for improvement?

Transaction messages can ensure the ultimate consistency of producers and consumers

In a flash sale project, I used RocketMQ to ensure the consistency of redis inventory and mysql inventory.

To be continued

There are still some introductions and codes that have not been added.

at last

2023-8-29 10:24:53

We all have a bright future

I wish you all the best in your postgraduate entrance exams, I wish you all success
in your work, I wish you all get what you wish for, like, collect and follow.


Guess you like

Origin blog.csdn.net/qq_51625007/article/details/132546158