News for hackers. Stuff that matters.
Re:Thread pools: How do I use them? by emmelaich on Sunday March 27, 2016 @06:04PM (#11371755)
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/concurre... 2. http://coopsoft.com/ar/CalamityArticle.html

Re:Thread pools: How do I use them? by cmsd2 on Sunday March 27, 2016 @07:01PM (#11371895)
A 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-s...

Re:Thread pools: How do I use them? by kevinavery on Sunday March 27, 2016 @11:12PM (#11372516)
Yep, 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

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.

Re:Thread pools: How do I use them? by wsargent on Monday March 28, 2016 @01:27AM (#11372877)
Re:Thread pools: How do I use them? by maherbeg on Sunday March 27, 2016 @10:02PM (#11372334)
The 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!