[
https://issues.apache.org/jira/browse/AMQ-9548?focusedWorklogId=934882&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-934882
]
ASF GitHub Bot logged work on AMQ-9548:
---------------------------------------
Author: ASF GitHub Bot
Created on: 16/Sep/24 06:53
Start Date: 16/Sep/24 06:53
Worklog Time Spent: 10m
Work Description: kenliao94 commented on code in PR #1288:
URL: https://github.com/apache/activemq/pull/1288#discussion_r1760617329
##########
activemq-broker/src/main/java/org/apache/activemq/broker/jmx/BrokerView.java:
##########
@@ -280,11 +280,21 @@ public ObjectName[] getTopics() {
return safeGetBroker().getTopicsNonSuppressed();
}
+ @Override
+ public int getTotalTopicsCount() {
+ return getTopics().length;
+ }
+
@Override
public ObjectName[] getQueues() {
return safeGetBroker().getQueuesNonSuppressed();
}
+ @Override
+ public int getTotalQueuesCount() {
+ return getQueues().length;
Review Comment:
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).
Issue Time Tracking
-------------------
Worklog Id: (was: 934882)
Time Spent: 0.5h (was: 20m)
> Add new broker mbean attributes to directly retrieve total number of queues
> and topics
> --------------------------------------------------------------------------------------
>
> Key: AMQ-9548
> URL: https://issues.apache.org/jira/browse/AMQ-9548
> Project: ActiveMQ Classic
> Issue Type: Improvement
> Components: JMX
> Affects Versions: 5.18.5, 6.1.2
> Reporter: Ken Liao
> Assignee: Ken Liao
> Priority: Major
> Fix For: 6.2.0
>
> Time Spent: 0.5h
> Remaining Estimate: 0h
>
> Right now, to monitor the number of destination, the only way is to read the
> destinations MBean and get the total destination. However, this means reading
> all destination names into memory, if the user has 10K+ destination with long
> destination name, it will be a large amount of memory just to monitor the
> number of them.
> The proposal here is to add either a new MBean value or a method to obtain
> that data. We can also add a method to retrieve the first K destination as
> well.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact