[
https://issues.apache.org/jira/browse/ARTEMIS-4814?focusedWorklogId=923355&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-923355
]
ASF GitHub Bot logged work on ARTEMIS-4814:
-------------------------------------------
Author: ASF GitHub Bot
Created on: 13/Jun/24 15:59
Start Date: 13/Jun/24 15:59
Worklog Time Spent: 10m
Work Description: clebertsuconic commented on code in PR #4972:
URL: https://github.com/apache/activemq-artemis/pull/4972#discussion_r1638460217
##########
artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/SimpleAddressManager.java:
##########
@@ -100,6 +102,8 @@ public boolean addBinding(final Binding binding) throws
Exception {
if (nameMap.putIfAbsent(binding.getUniqueName(), bindingAddressPair) !=
null) {
throw ActiveMQMessageBundle.BUNDLE.bindingAlreadyExists(binding);
}
+ directBindingMap.computeIfAbsent(binding.getAddress(), (unused) -> new
ArrayList<>())
+ .add(binding);
Review Comment:
you are using ConcurrentHashMap on the directBindingsMap, however you're
using a non Concurrent list on the value (new ArrayList)
I'm wondering if we shouldn't use something more protective in multi-thread
here.
I understand it's unlikely the broker to remove or add a queue on the same
address from multiple threads.. but it's not impossible. (say an application
with a MultiCast address and applications creating and deleting subscriptions
from multiple places).
it would be a rare race, but difficult to track if it ever happened.
Shouldn't we use something more protective here.. perhaps CopyOnWrite or
anything else?
Issue Time Tracking
-------------------
Worklog Id: (was: 923355)
Time Spent: 1h 40m (was: 1.5h)
> Remove linear iteration to get direct bindings
> ----------------------------------------------
>
> Key: ARTEMIS-4814
> URL: https://issues.apache.org/jira/browse/ARTEMIS-4814
> Project: ActiveMQ Artemis
> Issue Type: Task
> Components: Broker
> Reporter: Josh Byster
> Priority: Minor
> Time Spent: 1h 40m
> Remaining Estimate: 0h
>
> Currently, with 500K+ queues, the cleanup step of {{TempQueueCleanerUpper}}
> requires invoking {{WildcardAddressManager#getDirectBindings}}, which is O(k)
> in the number of queues.
> From method profiling, this can consume up to 95% of our CPU time when
> needing to clean up many of these.
> It would be nice to make this more efficient, which shouldn't be difficult
> given the iteration just does a simple equality check.
--
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