dehora / nakadi-java

🌀 Client library for the Nakadi Event Broker (examples: http://bit.ly/njc-examples, site: https://dehora.github.io/nakadi-java/)
MIT License
30 stars 19 forks source link

Allow to specify executor service instances for StreamConfiguration [performance] #322

Open PetrGlad opened 6 years ago

PetrGlad commented 6 years ago

In my observation "compute" threads are idle at least half of the time so sharing executor service with other parts in the system would help to reduce resource usage. This would help to reduce number of required threads when reading multiple streams. "io" threads seem to busy most of the time waiting on input so in that case shared executor service might be less beneficial but it is still nice to have some means to fine-tune thread factory.

So the suggested improvement is to have means to provide user-defined StreamProcessor#monoIoScheduler, and StreamProcessor#monoComputeScheduler (they won't be necessarily "mono" then :)

A good place for that might be nakadi.StreamConfiguration but probably there are better options.

ePaul commented 5 years ago

This would also allow to customize the generated threads, e.g. set a flow-ID.

ePaul commented 5 years ago

Also, it would allow to not have the threads all named the same (nakadi-java-compute-0 or nakadi-java-io-0). This makes it really confusing in the logs, if you have several StreamProcessors running in your application.