I have a Project Reactor chain which includes a blocking task (a network call, we need to wait for response). I\'d like to run multiple blocking tasks concurrently.
parallel
is tailored for parallelization of tasks for performance purposes, and dispatching of work between "rails" or "groups", each of which get their own execution context from the Scheduler
you pass to runOn
. In short, it will put all your CPU cores to work if you do CPU intensive work. But you're doing I/O bound work...
So in your case, flatMap
is a better candidate. That use of flatMap
for parallelization is more about orchestration.
These are pretty much the 2 alternatives, if you don't count the slightly different flavor of flatMap
that flatMapSequential
is (concatMap
doesn't really allow for parallelization).