ForkJoinPool makes task more efficient by spliting task to more subtasks , similar to map-reduce. But if the logic of the task itself cannot be split into several subtasks, what is the point of using ForkJoinPool? In reality, the logic of many actors’ receive methods cannot be split. Why can ForkJoinPool still improve efficiency?
If you look at the Java doc for ForkJoinPool it says:
This enables efficient processing when …, as well as when many small tasks are submitted to the pool from external clients. Especially when setting asyncMode to true in constructors,
ForkJoinPools may also be appropriate for use with event-style tasks that are never joined.
“Many small tasks” and “event styled”, matches actor message processing, and async in general, quite well. Even if there is no fork or join going on.
Thanks for replying.
Johan Andrén via Discuss Lightbend <firstname.lastname@example.org> 于2020年12月14日周一 下午9:05写道：