My stream has an even mix of CPU bound and IO bound stages (every IO stage is followed by a CPU stage). What I want to do is put the IO operations on a different dispatcher than the rest of the stream.
In a traditional actor based Akka application I could have put my IO actors on a fixed thread pool dispatcher with a lot of threads while putting the CPU bound actors on a fork join pool with a small number of threads (some multiple, ideally 1, of the number of cores). That should reduce time wasted in thread switching for the CPU bound actors while increasing throughput by having a lot of threads blocking on IO.
Is this understanding right? If not, why? If yes, then how do I put my IO bound stages (Flows) on a separate dispatcher from the rest of the stream?
I have tried turning off auto-fusing and that does help. But it still has a lot lesser throughput than the almost equivalent Akka counterpart.