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] With regards, Apache Git Services
