By Amit Hurvitz on Apr 22, 2014
Java 7 Fork and Join allows an easy way to perform dividable work by executing parallel tasks on a single computing machine. This article introduced a fork/join example of counting occurrences of a word in all files/directories under a root directory. I thought to check how these forked threads scale on a T5-4 server. Oracle T5-4 server has 4 processors, each has 16 cores. CMT technology allows 8 threads contexts per core (each core includes two out-of-order integer pipelines, one floating-point unit, level 1 and 2 caches, full specs here).
It took 1131.29 seconds for a single thread to process a root
directory with 1024 files, 1.25MB each. Increasing "parallelism level" —using the Java fork/join pool terminology —up to 2048, doing the same
work with fork/join took 7.74 seconds! Clearly it is worth setting the ForkJoinPool parallelism level manually to higher than...