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

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

                Author: ASF GitHub Bot
            Created on: 19/Jan/24 20:48
            Start Date: 19/Jan/24 20:48
    Worklog Time Spent: 10m 
      Work Description: tabish121 commented on PR #4753:
URL: 
https://github.com/apache/activemq-artemis/pull/4753#issuecomment-1901094401

   I've just sent my own PR for this issue.  I am skeptical of this change as 
it omits starting the actual added consumers after the first one which omits 
and calls to prompt delivery on the consumers as they are added. It also 
changes broker code that might impact other implementations that rely on the 
current behavior of those APIs which gives me pause.  I think the changes 
should be isolated to the openwire module if possible.  




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

    Worklog Id:     (was: 900774)
    Time Spent: 40m  (was: 0.5h)

> Don't start all previous consumers when new consumer added
> ----------------------------------------------------------
>
>                 Key: ARTEMIS-4575
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-4575
>             Project: ActiveMQ Artemis
>          Issue Type: Improvement
>            Reporter: Josh Byster
>            Priority: Minor
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
> I was running a benchmark to add many consumers, and I see that the marginal 
> cost of adding a new consumer increases due to a linear-time iteration 
> through all the existing consumers with OpenWire. It becomes very slow to add 
> a new consumer when there are already 100k+ on a session, for example. We 
> have thousands of topics and we see a huge performance slowdown due to this.
> More specifically, the stack trace:
> {code:java}
> org.apache.activemq.artemis.utils.ActiveMQThreadFactory$1.run(ActiveMQThreadFactory.java:118)
> java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
> java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
> org.apache.activemq.artemis.utils.actors.ProcessorBase.executePendingTasks(ProcessorBase.java:68)
> org.apache.activemq.artemis.utils.actors.OrderedExecutor.doTask(OrderedExecutor.java:32)
> org.apache.activemq.artemis.utils.actors.OrderedExecutor.doTask(OrderedExecutor.java:57)
> org.apache.activemq.artemis.utils.actors.ProcessorBase.executePendingTasks(ProcessorBase.java:68)
> org.apache.activemq.artemis.utils.actors.ThresholdActor.doTask(ThresholdActor.java:73)
> org.apache.activemq.artemis.core.protocol.openwire.OpenWireConnection.act(OpenWireConnection.java:369)
> org.apache.activemq.command.ConsumerInfo.visit(ConsumerInfo.java:352)
> org.apache.activemq.artemis.core.protocol.openwire.OpenWireConnection$CommandProcessor.processAddConsumer(OpenWireConnection.java:1280)
> org.apache.activemq.artemis.core.protocol.openwire.OpenWireConnection.addConsumer(OpenWireConnection.java:1001)
> org.apache.activemq.artemis.core.protocol.openwire.amq.AMQSession.start(AMQSession.java:257)
> org.apache.activemq.artemis.core.server.impl.ServerSessionImpl.start(ServerSessionImpl.java:1699)
> org.apache.activemq.artemis.core.server.impl.ServerSessionImpl.setStarted(ServerSessionImpl.java:2166)
>    {code}
> {{Most of the time is spent in this method, starting consumers that have 
> previously been started:}}
> {code:java}
> private void setStarted(final boolean s) {
>    Set<ServerConsumer> consumersClone = new HashSet<>(consumers.values());
>    for (ServerConsumer consumer : consumersClone) {
>       consumer.setStarted(s);
>    }
>    started = s;
> } {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to