[ https://issues.apache.org/jira/browse/ARTEMIS-2236?focusedWorklogId=188792&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-188792 ]
ASF GitHub Bot logged work on ARTEMIS-2236: ------------------------------------------- Author: ASF GitHub Bot Created on: 23/Jan/19 10:04 Start Date: 23/Jan/19 10:04 Worklog Time Spent: 10m Work Description: michaelandrepearce commented on pull request #2514: ARTEMIS-2236 Address Latency Impact caused by ARTEMIS-1451 URL: https://github.com/apache/activemq-artemis/pull/2514#discussion_r250125913 ########## File path: artemis-commons/src/main/java/org/apache/activemq/artemis/utils/ActiveMQThreadPoolExecutor.java ########## @@ -64,20 +63,15 @@ public void setExecutor(ActiveMQThreadPoolExecutor executor) { public boolean offer(Runnable runnable) { boolean retval = false; - // Need to lock for 2 reasons: - // 1. to safely handle poll timeouts - // 2. to protect the delta from parallel updates - synchronized (lock) { - if ((executor.getPoolSize() >= executor.getMaximumPoolSize()) || (threadTaskDelta > 0)) { - // A new task will be added to the queue if the maximum number of threads has been reached - // or if the delta is > 0, which means that there are enough idle threads. + if (threadTaskDelta > 0 || (executor.getPoolSize() >= executor.getMaximumPoolSize())) { Review comment: getPoolSize uses a lock underneath in the executor, so we possible can avoid that when we have idle threads. if threadTaskDelta > 0 (which means we have idle) then we can offer, we only need to see if we are at max if we dont have idle. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking ------------------- Worklog Id: (was: 188792) Time Spent: 11h 20m (was: 11h 10m) > Address Latency Impact caused by ARTEMIS-1451 > --------------------------------------------- > > Key: ARTEMIS-2236 > URL: https://issues.apache.org/jira/browse/ARTEMIS-2236 > Project: ActiveMQ Artemis > Issue Type: Bug > Affects Versions: 2.4.0, 2.5.0, 2.6.0 > Reporter: Michael Andre Pearce > Priority: Blocker > Time Spent: 11h 20m > Remaining Estimate: 0h > > h1. ARTEMIS-1451 whilst may have removed syncronisation, increased latency as > the overhead of creating a new thread vs re-using an idle one is significant. > It is the main reason of a thread pool. -- This message was sent by Atlassian JIRA (v7.6.3#76005)