September 12, 2016
The vmlens executor service is a high throughput executor service. It achieves three times higher throughput than the standard JDK executor service. The tradeoff is that the latency is much higher than that of the standard JDK executor service. Here are my benchmark results:
The figure shows the throughput of the vmlens executor Service compared to the standard JDK executor service for different threads on JDK 8.
The figure shows the latency of the vmlens executor Service compared to the standard JDK executor service for different threads on JDK 8. Both benchmarks were run with jmh on an intel i5 4 core CPU. The source of the benchmark can be downloaded here
public class QueueManyWriters private final ThreadLocal lastWrittenQueueNode = new ThreadLocal(); public void accept(E element) { if( dispatcherThread.stop ) { throw new RejectedExecutionException(); } QueueNode current = new QueueNode(element); if( lastWrittenQueueNode.get() == null ) { writingThreads.append(current,Thread.currentThread().getId()); lastWrittenQueueNode.set(new LastWrittenQueueNode(current)); } else { lastWrittenQueueNode.get().last.next = current; lastWrittenQueueNode.get().last = current; } } ... } public class QueueNode { final E element; volatile QueueNode next; public QueueNode(E element) { super(); this.element = element; } }Reading is done by a single dispatcher Thread. The dispatcher collects the tasks and pushes them to one of the worker thread. For collecting the tasks the dispatcher thread uses a local list. The list contains the last read element for each writing thread.
© 2020 vmlens Legal Notice Privacy Policy