On 21/02/2014 03:12, Samuel Ainsworth wrote:
> 2. More probable: The garbage collector constrains threads in certain
> ways when it is under stress. I tried running a similar experiment but that
> was less memory intensive. Instead of building lists from 1 to n, I tried
> factorizing the numbers which is obviously more CPU intensive but will hit
> the GC much less. It cranked up all of my cores to 100% as expected. I
> guess the moral of the story here is that when using parallel collections
> avoid hitting the GC and go for CPU intensive computations instead. Results
> may vary based on heap size, CPU, day of week, etc.
With your original code on a 256-core machine I was seeing more GC
threads active than I was application threads. And if I abused it badly
enough I could even induce the dreaded 'GC overhead limit exceeded'
which indicates that over 98% of the time was being spent in GC.
I know that there's a current meme that immutability + actors = instant
scalability. Immutability is clearly a big help as it helps avoid
locking, I'm less persuaded by actors. However they are both subject to
the same limitations that you were hitting with your example - either in
the underlying implementation (thread pool), or because you don't
actually have an infinite amount of memory (garbage collection) or
because of platform limitations (OS scalability). Basically, the
oft-promised free lunch has still not arrived :-)
--
Alan Burlison
--