Skip to content

Make the executor service of ParallelFlow configurable #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
fmbenhassine opened this issue Feb 29, 2020 · 0 comments
Closed

Make the executor service of ParallelFlow configurable #12

fmbenhassine opened this issue Feb 29, 2020 · 0 comments
Labels
Milestone

Comments

@fmbenhassine
Copy link
Member

As of v0.1, the ParallelFlow implementation uses an internal executor service to run work units in parallel. The idea behind this design is to be able to create and shutdown the executor service internally and free the user from having to do that.

However, the drawback of this design is that every parallel flow uses its own executor service, which is obviously not efficient since the creation of thread pools is expensive. Moreover, using an internal executor service is not open for customizations.

This is a trade-off between:

  1. Lifecycle management of the executor service (creation/shutdown)
  2. Efficiency (re-using the same executor service for all parallel flows) and customization of the executor service

I believe trading option 1 for option 2 is a wise decision. In the end, the executor service lifecyle management is a couple of lines of code, for example:

ExecutorService executorService = Executors.newFixedThreadPool(10);
// pass executorService to parallel flow
executorService.shutdown();
@fmbenhassine fmbenhassine added this to the v0.2 milestone Feb 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant