Skip to content
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

[AMQ-9548] Add attributes to display total number of queues and topics #1288

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kenliao94
Copy link
Contributor

What problems does this PR solve?
Currently, to get the total number of queues and topics on the broker using JMX, one needs to query the attribute values of Queues and Topics on the broker MBean then post-process it (finding the length of returned array) to get that data. This can be resource intensive (unnecessary copy of the data) on the customer application using JMX or Jolokia if user has tens or thousands of destinations and all the user wants is the number. Hence this PR added two attributes so customer application can just query the total number without getting the list of topics and queues first.

Why is it beneficial to merge into ActiveMQ?
This will be beneficial for users with high number of destinations. They can now monitor the total number of queues and topics in a more performant way.

How do you make sure this PR is well tested?

  • Added unit test in the PR
  • Tested with Jolokia (cross-checked with the web console) [see attachment below]
  • Tested with Jconsole (cross-checked with the web console) [see attachment below]

image
image
image

@Override
public ObjectName[] getQueues() {
return safeGetBroker().getQueuesNonSuppressed();
}

@Override
public int getTotalQueuesCount() {
return getQueues().length;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This still calls a method that creates a new array of objects. Why not just return the value of the size from the map?

Copy link
Contributor Author

@kenliao94 kenliao94 Sep 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good callout, I believe the new array of objects you are referring to is the one created in onlyNonSuppressed which copy over the non suppressed queues or topics already maintained in the ManagedRegionBroker. Are you saying I should just simply return the size of private final Map<ObjectName, DestinationView> queues = new ConcurrentHashMap<>(); in ManagedRegionBroker?

My concern is that it will not agree with the queue or topic list in the queues and topics MBean attribute, and those are non suppressed which should be the correct list.

The optimization done at this PR is mainly for user application. Because they will need to read that ObjectName array into their memory space even all they need is the count of queues or topics. So if this PR is merged as it is, the user application memory space will not be bloated (even tho as your pointed out, on the broker side, it will still need to create an array of those objects on the broker process memory space).

WDYT?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants