[
https://issues.apache.org/jira/browse/ARTEMIS-4575?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17809502#comment-17809502
]
ASF subversion and git services commented on ARTEMIS-4575:
----------------------------------------------------------
Commit 54f5dae458ab7bc1ce554e8c5b74c8fa30401833 in activemq-artemis's branch
refs/heads/main from Timothy Bish
[ https://gitbox.apache.org/repos/asf?p=activemq-artemis.git;h=54f5dae458 ]
ARTEMIS-4575 Only start the consumers that were added
Change from forcing a session start cycle on each consumer add
event and start only those consumers that were added which will
trigger a prompt delivery action on each. The session should be
marked started on create to account for the remove of the start
on each consumer add event.
> 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: 1h 20m
> 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)