ParallelFlux vs flatMap() for a Blocking I/O task

删除回忆录丶 提交于 2019-11-30 06:50:32

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).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!