-
Notifications
You must be signed in to change notification settings - Fork 66
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
RabbitMQ partition allocation is not uniformly distributed #1744
Comments
related: |
@cailyoung this is a very correct findings. and this is another very correct statement:
which explains why we didn't make changes yet. First - we understand and acknowledge that the current implementation is not ideal and violates some scaling principles, but there were certain problems that we needed to address. Problem#1: We had to resolve the issue of handling a situation where one project (or one launch) creates a massive load on the API, such as reporting 15,000 test cases with 1,000 logs each in 50 threads. In this scenario, any other project (launch) running concurrently might end up getting processed at a much slower pace. This now manifests in that autoscaling is not feasible since we need to restart RabbitMQ anyway to configure it for the new potential queue count. That means that with the addition of new API nodes, Rabbit must receive new configurations and be restarted. Problem#2: In the early stages of reporting development, we were quite conservative with permissions in the reporting sequence (events coming into processing). Such as not being able to create a child before creating a parent or completing a parent before completing a child. This stemmed from the fact that we couldn't write logs to the database, for example, until we knew the test case ID. Namely, this involved adding the very Therefore, the re-try queue was where the events for children fell into, and the API would prioritize returning to this queue every 10 messages processed from the main queues. This way, we do not lose the recording of objects, which might be due to reasons such as network delivery delay, where even a 1ms difference matters. Furthermore, these re-try queues later allowed us to address various specifics of JS frameworks, which often send the completion of parents before they finish all descendants or sometimes even before their start. Considering all these specifics, we are planning significant changes for the version code-named RPv6. It will encompass a great deal, but primarily changes regarding queues and how data is stored. Flat structure. Thus, this opens the possibility for one large queue, from which any number of API nodes can pull events for processing and store them in the database, free from the constraints of maintaining structure. We still should have events across different queues so that incoming events from less busy launches still have the opportunity to be processed before the completion of processing heavyweights from other projects. But now, it is no longer necessary to retain a particular launch's affiliation to specific queues. It is permissible to allow the API to pull messages for processing from any available queues. This will enable the use of multi-node APIs and multiple Rabbit nodes. |
Thankyou for the considered response and I look forward to seeing these improvements in this space! |
@DzmitryHumianiuk returning to this now that 24.2 is out with consistent-hash exchange - I still see the same behaviour, where we have launches with lots of messages getting their entire message load put onto a single queue, and the exclusivity of the queue consumer means we cannot scale up consumer workers to deal with the backlog. I note that the recent blogpost talks about 2000rps handling - we are only ever seeing 30-70rps consumption per queue, which means when 100k messages are dropped on a single consumer it takes a very long time to work through. Is there anything now preventing having multiple consumers per queue? |
@cailyoung are these messages related to the same launch? |
@cailyoung |
We've noticed in our installation with 32 replicas of this service (320 queues in RabbitMQ) that we routinely have single
reporting.x
queues with very high message counts compared to the others. Think 100k messages versus zero, or a few hundred.I believe this is due to a combination of choices in this service:
api
replica holds an exclusive connection on its queues, meaning when there's unbalanced queues only a single consumer can work through the backlogI think this could be resolved by either:
api
replicas compete on the same consuming queue for new messages. This might be complex to migrate into from the current state!api
replica size safer, as the current implementation requires each replica to be aware of the entire queue count at startup and will create more queues based on that number - so scaling down leaves orphaned queues.The text was updated successfully, but these errors were encountered: