-
Notifications
You must be signed in to change notification settings - Fork 11.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RIP-72] : Add a message gray solution , compatible with RocketMQ 4.x and RocketMQ 5.x #8469
base: develop
Are you sure you want to change the base?
Conversation
perfect |
@syhleo Hello, I have a question. If the producer is configured with grayscale, but the consumer is not configured with grayscale, then the data in the grayscale queue will also be consumed by normal consumers. The same is true in reverse. Is this in line with expectations? |
hi, in the issue's Describe the Solution, i found a note about this, it seems within expectations |
of course, You can see the related documentation:语雀 |
If the grayscale message and normal message data formats are inconsistent, and grayscale is enabled for production but not for consumption, will the grayscale data consumed normally fail to parse or cannot be processed normally? |
Yes. If only the production is gray, the consumption is not gray, that is, the gray consumption does not exist at all, that is, all the messages are consumed by the normal consumer end. However, first of all, the change of MQ message data format, the production side and the consumer side are to be logically adjusted together, if your business scene inside the production side of the grayscale message and the data format of the ordinary message is inconsistent, the consumer side needs to follow together with the grayscale, so that the grayscale consumer side consumes the grayscale message (data format A). The normal consumer consumes normal messages (data format B). This is also the full-link gray scale release that we have been advocating. |
I tried it. It works. |
What I want is that the grayscale queue can only be consumed by grayscale consumers. When there is no grayscale consumer, I don’t want the data of both the grayscale queue and the ordinary queue to be consumed by normal consumers, so that the data is strung together. |
When implemented this way, there will be problems. Imagine this: If your producer service is in a grayscale environment, at this time a steady stream of grayscale messages are sent, and your consumer service is not in grayscale (because the consumer service has no distribution requirements at all, it has been a non-grayscale state), if the grayscale queue can only be used by grayscale consumers, in this case, the grayscale queue will cause a large number of messages to accumulate. During grayscale, grayscale queues can only be used by grayscale consumers, provided that there are grayscale consumers. If there are grayscale consumers, it is absolutely guaranteed that the grayscale queue can only be used by grayscale consumers. What we need to do is, during the full link gray scale release, the messages sent by gray scale producers can be accurately consumed by gray scale consumers, and the messages sent by non-gray scale producers can be accurately consumed by non-gray scale consumers, so that the gray scale verification involving MQ message changes can be preserved in the business. In order to ensure the normal switching between gray level and gray level, the same group of consumers perceive each other whether there are consumers with gray level identification to determine whether non-gray level consumers need to take over the gray level queue message. |
This solution has been implemented in our production environment, and the access method is also low-cost, which confirms its stability and security. |
Our usage scenarios are different. In our production implementation, grayscale can only be consumed by grayscale, and grayscale and ordinary messages are separated. Otherwise, they will be mixed and the meaning of grayscale will be lost. |
Well, each scheme has advantages and disadvantages. For schemes such as Shadow topic and group, on the one hand, there is a critical problem, that is, when gray verification is switched to prod, there may be messages missed consumption, which is unacceptable. On the other hand, there is the cost problem. If you think about the relatively large scale of the business, the cost brought by doubling each topic and group can not be ignored. |
Good idea. I have a question: how will this solution do when we need more than one gray environment? Like Git branch, we may have several active branches and each of them runs in its independent gray environment. |
First of all, thank you very much for your response and for asking the question. This solution also effectively addresses this issue when multiple grayscale environments are required.
In fact, most enterprises want to perform gray-scale validation of MQ messages in a low-cost and convenient way in an all-link gray-scale publishing scenario. However, when MQ does not support grayscale messages, it involves a change in consumption logic, and developers often need to add a lot of compatibility logic to the code. Nonetheless, these logics can only ensure that the new business does not affect the online, but cannot ensure that the grayscale traffic accurately enters the grayscale consumption client, thus preventing strict grayscale validation. With this solution, these problems can be effectively solved. |
#3265 21年我提交过相同的方案 |
Thank you for your response. While comparing our solutions, I noticed the following differences between this solution and your previous one: 1.MQ version support: This solution is compatible with RocketMQ 4.x and RocketMQ 5.x. |
In the following description, the current environment is referred to as the "base environment," to distinguish it from the "gray environment."
|
Thank you very much for your feedback. 1.Regarding the startup sequence of gray consumers: Yes, the PR recommends that gray consumers be started before gray producers to ensure that gray messages are correctly processed. 2.Regarding the issue of subscription inconsistency: This PR does not address scenarios with inconsistent subscriptions, as this issue is not caused by the gray partitioning scheme. Even without the gray scheme, when gray consumers (gray pods) and base consumers (base pods) have different subscription relationships, the same problem will occur. However, the issue of inconsistent subscriptions can be resolved through other means. 3.Regarding rewrite load balancing rules and select message queue function: The Remoting Protocol client can indeed have its logic rewritten. Apologies, I haven't yet found the entry point for this. However, to ensure compatibility with RocketMQ 5.x server-side load balancing and to support both Pop and Push consumption modes, the PR introduces additional client configurations, providing a simple and flexible way to integrate the gray feature. 4.Multi-environment and gray release: The gray partitioning scheme and binding of different environments to corresponding queues do not conflict; rather, they complement each other. This design ensures that each environment can carry out gray releases in an orderly and independent manner. Additional Notes: |
First of all, thank you very much for your response Share the link Case Scenario Description: |
@qianye1001 question 1no users can guarantee it, this canbe a BIG problem, can we unbind the dependency on producer and consumer? question 2consumers in different-subscriptions, gray and normal consumers could be in-a-mess, how to make sure consume offset's right my questionhow gray consumer change into normal consumer. from the source code to see, it need to update consumer config and restart, can do it in admin tools? |
Thank you for your feedback. @qianye1001 @francisoliverlee Gray-to-normal bridging issue: |
Thank you very much for all the great replies. I have summarized the above discussion in the 语雀, so feel free to share and discuss the grayscale scenarios or MQ grayscale solution that your respective companies are experiencing. 🌹 |
Which Issue(s) This PR Fixes
[Enhancement] Add message gray strategy solution #8468
Brief Description
a solution for message gray.
The solution provides an extensible message grayscale solution for implementing message grayscale publishing that supports
RocketMQ 4.x
andRocketMQ 5.x
. It is compatible withPOP
consumption mode andPush
consumption mode. No matter the client-rebalance or server-rebalance, the solution can realize the message gray level in a lightweight way.The solution has been widely applied and verified in our projects, which confirms its reliability, security, and stability.
How Did You Test This Change?
Easy access. Business parties control only a few client configurations, such as
enableGraySwitch
andgrayTag
, to seamlessly access RocketMQ's gray-scale publishing capabilities, enabling full-link gray-scale publishing.Specific can refer toorg.apache.rocketmq.example.gray