6 ms·
Great writing. I wonder if a ForkJoinPool [1] would be helpful here as it does work-stealing giving better utilisation. Although I've read admonitions that th
by emmelaich 11y ago
Great writing.
I wonder if a ForkJoinPool [1] would be helpful here as it does work-stealing giving better utilisation.
Although I've read admonitions that they should not be used when doing I/O. [2] That article seems a little ranty and overblown though, so I'd like opinions on that.
1. https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ForkJoinPool.html https://docs.oracle.com/javase/8/docs/api/java/util/concurre...
2. http://coopsoft.com/ar/CalamityArticle.html http://coopsoft.com/ar/CalamityArticle.html
- cmsd2 11y agoA coworker showed me Akka Streams recently. It allows you to overcome the impedence mismatch between threadpools processing jobs at different speeds where one task feeds into another. Could be a neat way to join up the i/o bound tasks to the cpu bound tasks. https://opencredo.com/introduction-to-akka-streams-getting-started/ https://opencredo.com/introduction-to-akka-streams-getting-s...
- kevinavery 11y agoYep, it's a really cool library. I'm pretty new to it myself, but I made a little gist of how one might approach this problem: https://gist.github.com/kevinavery/941e7d67c4f8b104f610 https://gist.github.com/kevinavery/941e7d67c4f8b104f610 I was kinda surprised by how tricky it was to make a Flow that turned ByteStrings into separate String lines, but it seems like the custom GraphStage approach generalizes really well to more complicated stages.
- wsargent 11y agohttps://rnduja.github.io/2016/03/25/a_first_look_to_akka_stream/ https://rnduja.github.io/2016/03/25/a_first_look_to_akka_str... is also pretty good.
- maherbeg 11y agoThe article is definitely super ranty and a bit overblown. The Fork/Join framework is actually pretty solid and works for a wide variety of use cases and has a relatively simple API. It's an excellent article though and I highly recommend anyone implementing the use of Fork/Join to read it and get more in depth knowledge. Java 8 made some improvements in code quality and safety and the framework underlies all of the parallel streaming abstractions used going forward. It's definitely worth learning all of the concurrency abstractions available in the JDK too though!