activemq-artemis

ActiveMQ Artemis missing MBeans


The MBeans for ConsumerCount on each queue, TotalConsumerCount and ConnectionCount are exposed but why not ProducerCount and SessionCount?

Why do I need it?

I have set alerts for the number of consumers and the number of connection, but don't have for number of Producers and Sessions. The increasing number of producer and session from one connection can easily consume resources like CPU and Memory both, creating OOM or eventually a crash.

Also, Can I limit the number of producers and consumers of a given session?


Why limiting number of connections doesn't work for me?

I got a scenario where one connection created more than some thousands of sessions under one connection which led to a crash.


Solution

  • Thanks to ARTEMIS-5320 both SessionCount and TotalSessionCount are now available on the ActiveMQServerControl MBean in ActiveMQ Artemis 2.40.0.

    It's worth noting that the documentation you cited was recently update to clarify what resources are actually being tracked. In short, sessions are tracked here, not connections. Therefore, you should be able to use a resource-limit-setting to limit the number of sessions a user can create which will mitigate the risk of a crash in the specific use-case which you outlined.

    Lastly, reliably tracking "producers" is essentially impossible in most cases since most protocols (e.g. AMQP, STOMP, MQTT) don't even have the notion of a "producer." Client applications using these protocols simply send messages. There is no need to create a "producer" and there are no corresponding server-side resources. Of course, the JMS API does have a concept of creating a producer (e.g. via Session.createProducer(Destination)). However, it also supports the notion of an "anonymous" producer (by passing null) which can send to an arbitrary Destination. Overall the broker does the best it can to track "producers" but it isn't reliable enough to enforce limits. What you should really be tracking & alerting on here is messages.