Johan's blog
Java Performance and L2 cache
It surprises me how many times Java Performance is considered to be linear proportional to the clock frequency of the CPU, thereby ignoring all other parameters. Recently, the motherboard of a server running a GlassFish based Dali Community project was replaced. The CPU frequency was increased from 2.4 to 2.5GHz, but the L2 cache was lowered from 2x4 to 2x3MB. I immediately noticed a drop in performance. Not a huge drop, but still.
L2 cache is one of the most important things when talking about Java Performance. When an operation needs to retrieve data from main memory instead of L2 cache, this may cost 500 cycles. L2 misses are therefore extremely expensive. Therefore, software should be designed to make optimal use of the L2 cache. See the PhD dissertation of Dries Buytaert for a deep analysis about performance analysis and optimization for more numbers, and for some (pre-production ready) tools for detecting pieces of code that lead to large numbers of L2 misses. Well done, Dries. The Java future looks bright to you!
I missed a presentation of Michael Hind during Dries' PhD defense, but the title says a lot: "The impact of multicore architectures on software" --- see this abstract. With the recent approach of not exponentially increasing the clock frequency, but rather adding more processing cores on a chip, new challenges arise. In many architectures, the L2 cache has to be shared between different cores.
Performance is a complex issue. It involves software and hardware, at different levels. And although there are common sense techniques, many project should be optimized in a specific way to get the most out of it.
