This post is over a year old, some of this information may be out of
date.
Introduction
I have tried and put up some examples at https://github.com/mallim/java101 (look for completablefuture package).
On my laptop, RealLifeWithoutCompletableFutureExample took 15087 ms and RealLifeCompletableFutureExample 5098 ms.
Hmm.. so there is a a difference.
Libraries related to CompletableFuture
- tascalate-concurrent
- cyclops-react - good introduction at What is Cyclops-react? and homepage at http://cyclops-react.io/
- ea-async - EA Async implements async-await methods in the JVM. It looks like a simplified version of kilim
Libraries related to Executor/Executor Service
- async-retry
- vmlens Executor service - A high throughput java executor service
- About ExecutorServices take note on the section about Dynamic ThreadPoolExecutor and there is a formula for Sizing Thread Pools.
- BlockingThreadPoolExecutor A Blocking ThreadPoolExecutor (alternative ThreadPoolExecutor Java)
Parallel Stream --> CompletableFuture
- Java 8: CompletableFuture vs Parallel Stream
- Gentle introduction to Completable Future gives a Thread Pool Size Formula
Spring @Async with CompletableFuture
- One example - based on Spring Boot 2.0 works nicely.
- Completable futures with Spring async - you will need the tips here if you want @Async to work with Spring 3.X, seems like no such problem on Spring Boot 2.X. There is an example here
- Good tips on Spring @Asyn here
Nthreads) = Ncpu * Ucpu * (1 + W/C)
Ncpu - number of cpus
Ucpu - cpu utilization
W/C - ration of wait to compute time