[ 
https://issues.apache.org/jira/browse/ARTEMIS-4814?focusedWorklogId=923397&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-923397
 ]

ASF GitHub Bot logged work on ARTEMIS-4814:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 13/Jun/24 22:49
            Start Date: 13/Jun/24 22:49
    Worklog Time Spent: 10m 
      Work Description: joshb1050 commented on code in PR #4972:
URL: https://github.com/apache/activemq-artemis/pull/4972#discussion_r1639023553


##########
artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/SimpleAddressManager.java:
##########
@@ -116,7 +121,15 @@ public Binding removeBinding(final SimpleString 
uniqueName, Transaction tx) thro
          return null;
       }
 
-      removeBindingInternal(binding.getA().getAddress(), uniqueName);
+      SimpleString address = binding.getA().getAddress();
+      removeBindingInternal(address, uniqueName);
+      Collection<Binding> directBindings = directBindingMap.get(address);
+      if (directBindings != null) {
+         directBindings.remove(binding.getA());
+         if (directBindings.isEmpty()) {

Review Comment:
   Should we perhaps put this in a `ConcurrentHashMap#compute` lambda instead?





Issue Time Tracking
-------------------

    Worklog Id:     (was: 923397)
    Time Spent: 2h 10m  (was: 2h)

> 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: 2h 10m
>  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: issues-unsubscr...@activemq.apache.org
For additional commands, e-mail: issues-h...@activemq.apache.org
For further information, visit: https://activemq.apache.org/contact


Reply via email to