Hello,
I‘m looking for a general advice when to use single exchange or when consider splitting into multiple exchanges.
The use case is pretty simple.
Service A (publisher) receives events from REST endpoint and publishes them to RabbitMQ.
Service B (publisher and consumer) listens for messages from Service A, enriches them with additional data and published back to RabbitMQ.
Service C (consumer) listens for messages from Service B and sends them to data analytics storage.
There will be ~1000 event messages per second coming in from Service A. Under ideal conditions the processing of messages in all three “cycles” would happen in seconds. However we design a system for 24 hour persistence using dead letter queues and TTL, in case part of the system goes down.
Previously we would just simply use one topic exchange for all producers. All consumers would have their dedicated queues and binding keys. But now I’m doubting if that was the right call. I cannot explain it, but it doesn’t feels right. Even though all services are essentially one domain the messages before and after data enrichment are quit different (much larger). We also don’t need wildcard support and I’ve read that topic exchanges are slower than direct. Not sure if that’s still the case for RabbitMQ 3.13/4.x series, as most of the blog posts about exchanges I found are quite old.
Even if we switch from topic to direct exchange there is still a question should we split into two exchanges or not?
I’m also concerned about how publishing from two different service to the same exchange affects performance. If let’s say suddenly Service A has to publish a large amount of messages, will it also slow down Service B publisher? In other words, are exchanges single threaded in RabbitMQ?
--
Best Regards,
Vilius
--
You received this message because you are subscribed to the Google Groups "rabbitmq-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-user...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/rabbitmq-users/AM8PR01MB81340272B43E49B6448A0F769207A%40AM8PR01MB8134.eurprd01.prod.exchangelabs.com.
OK. So what are the main factors deciding on when messages purposes needs separate exchanges?
--
Vilius
--
You received this message because you are subscribed to the Google Groups "rabbitmq-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
rabbitmq-user...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/rabbitmq-users/CAOByxJLnL8vYkVG2X-3TTptjAHhy5aAzF%2BzvbRpYfD7wQjU7Ng%40mail.gmail.com.
Thank you for detailed explanation Michal.
One more question regarding publishing to the exchange. Is receiving a message, scanning through binding, keys and routing to appropriate queue, a single threaded operation on RabbitMQ side?
--
Vilius
To view this discussion visit https://groups.google.com/d/msgid/rabbitmq-users/CALWErWL5%3D91uH5L6wM7h%3DYfwVy2hnZLEPgji%2BHeHGb0DpWfxfg%40mail.gmail.com.
OK. It is more clear now.
One additional question. Given that exchange is a dataset, not a process, does it have a size limit and is there a way to monitor the size (in case I deploy new producer but consumers are not yet deployed and no queues or bindings exist)? I haven’t found anything in RabbitMQ Management UI or Prometheus metric list.
To view this discussion visit https://groups.google.com/d/msgid/rabbitmq-users/CALWErWJDQ6KKbcfFLeLnAXZS6ZKyx%2BdZFjCdnP0ghVv%3DQCc-uw%40mail.gmail.com.
I don‘t really want to count bindings. Since exchange is a dataset, I had an impression that exchange, without any queues and bindings attached to it, just stores the messages indefinitely until at least one queue and binding appears. By size, I meant the sum of all those messages. From your answer it looks like messages in such case are just dropped, so I now understand that it is unnecessary.
The reason I was asking is that when microservices are developed, to have a proper separation, you usually define the destination (exchange) and the routing key in the producer, but the queue and the binding key is defined in the consumer. For various cases, this could result in exchanges not having queues attached to them at least temporarily.
To view this discussion visit https://groups.google.com/d/msgid/rabbitmq-users/CALWErWKnzQfqPbEU%2BQw-U6KHvf2ww5nfJpdRS%3DBTDHag5ECKDg%40mail.gmail.com.
Thank you again Michal.
Such deep knowledge how RabbitMQ internals work really helps to understand it now.
To view this discussion visit https://groups.google.com/d/msgid/rabbitmq-users/CALWErWLE%3D1C6CUL3vmrK-KEMWPsfp7066KJoOORo2EcBYtnKAQ%40mail.gmail.com.