ActiveMQ topic starvation

50 Views Asked by At

I have one ActiveMQ 5.16 broker configured on Amazon and two topics, say topic1 and topic2, and I'm connecting using a JMS producer and consumer.

My question is if one of the topics is extremely high fidelity (like 10k messages/sec) and the other one is very very low fidelity one then how would the load balancing work in ActiveMQ? Will it result in one of the topics being starved? In other words, will topic1 publish get backed up and because of that will the topic2 consumer get messages delayed? In that case is it better to use two different queues with different brokers then?

To clarify, I don't have any actual data that indicates this is a real problem. I am just starting my implementation so this is more of a theoretical question.

2

There are 2 best solutions below

1
Justin Bertram On BEST ANSWER

There is no "load balancing" per se among different topics. It's essentially first come, first serve without any explicit coordination.

Generally speaking, if you really care about performance you should probably be looking at ActiveMQ Artemis rather than ActiveMQ "Classic." ActiveMQ Artemis has a non-blocking architecture that scales much better under load. You're less likely to get into situations where threads are having to wait on each other.

2
balaji balu On

In pub/sub mode, loading a topic will not affect another topic because each topic will have its own queue.

In a point-to-point mode, there will be only one queue. All the published message types will land in the same queue. Messages are delivered to the available consumers in a round robin way. If a subscriber is busy, broker will send it to next available consumer.