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

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

                Author: ASF GitHub Bot
            Created on: 23/Jan/19 10:27
            Start Date: 23/Jan/19 10:27
    Worklog Time Spent: 10m 
      Work Description: franz1981 commented on issue #2514: ARTEMIS-2236 
Address Latency Impact caused by ARTEMIS-1451
URL: https://github.com/apache/activemq-artemis/pull/2514#issuecomment-456749562
 
 
   @michaelandrepearce 
   PLease run this one:
   ```
       public static void main(String[] args) throws Throwable {
           final int consumers = 7;
           final int producers = 1;
           ExecutorService es = new ActiveMQThreadPoolExecutor(0, consumers, 
60, TimeUnit.SECONDS, Thread::new);
           ExecutorService producerExecutor = 
Executors.newFixedThreadPool(producers);
           final int tasks = 10_000_000;
           final AtomicLongArray executedTasks = new AtomicLongArray(consumers);
           final AtomicInteger consumerIndex = new AtomicInteger();
           final ThreadLocal<Integer> position = 
ThreadLocal.withInitial(consumerIndex::getAndIncrement);
           final Runnable producer = () -> {
               for (int i = 0; i < tasks; i++) {
                   es.submit(() -> {
                       final int index = position.get();
                       executedTasks.lazySet(index, executedTasks.get(index) + 
1);
                       if (index % 2 == 0) {
                           LockSupport.parkNanos(1);
                       }
                   });
               }
           };
           for (int i = 0; i < producers; i++) {
               producerExecutor.execute(producer);
           }
           final long expectedExecuted = tasks * producers;
           long totalExecuted;
           do {
               totalExecuted = 0;
               for (int i = 0; i < consumers; i++) {
                   totalExecuted += executedTasks.get(i);
               }
               if (totalExecuted == expectedExecuted) {
                   break;
               } else {
                   TimeUnit.SECONDS.sleep(1);
               }
           } while (true);
           //print execution summaries
           for (int i = 0; i < consumers; i++) {
               System.out.println(((executedTasks.get(i) * 100) / 
expectedExecuted) + " % for consumer = " + (i + 1));
           }
           producerExecutor.shutdown();
           es.shutdown();
       }
   ```
   You can run it with both the old version (the broken one) or the ones on 
your PR and you can check what is the actual task distribution: you will see 
that the behaviour is very different.
   That's somthing to consider IMHO, but please try it and tell me wdyt
 
----------------------------------------------------------------
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:
[email protected]


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

    Worklog Id:     (was: 188807)
    Time Spent: 12h 10m  (was: 12h)

> 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: 12h 10m
>  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)

Reply via email to