There are a number of easy things to consider for optimizing and improving your Java performance on Linux on Power systems. Here we'll provide some advice and considerations.
In general, the newer the version, the more optimizations have been included for newer platforms like the POWER6 processors and systems.
Note that this page focuses on the Java engine itself. When working with environments like Websphere, each Websphere version comes bundled with a particular Java Version / service level.
Where to get the latest Java
IBM provides an easy download site for access to the latest Java service levels
Note that 32bit and 64bit versions are regularly provided for Java Version 6, Java Version 5.0, and Java 1.4.2 for the Power base.
Related Tuning Information
Brand new paper: IBM Just-in-time Compiler (JIT) for Java: Best practices and coding guidelines for improving performance
There's an interesting new IBM RedBook which focuses on AIX, Websphere, and Java, but we've found that Chapter 6 in this guide is a nice guide for Java tuning advice on the Power platform.
Other good reference materials
and
I'm running Linux, what do I need to tune in Linux?
In general, if you're running on the latest distro releases for Power (SLES 10 sp2 and RHEL 5.2), with the latest service Java service packs, you should get pretty good performance "out of the box".
RHEL 5.2 offers an advantage of 64KB base page sizes, which in many cases can provide incrementally better overall system performance.
Both SLES 10 and RHEL 5 provide the ability to back the Java heap with "huge pages" (the 16MB pages supported by Power systems) which can provide some additional performance gains over the normal base page sizes.
We inevitably hear from Linux users that they want to know the magic kernel tweaks and sysctl changes to be made to optimize their Java application on Power. The reality is that the Linux operating system is already nicely tuned for the Power systems and there isn't much you need to do.
Java versions
- Java Version 6 SR2 is the latest level
- Java Version 5.0 SR8a is the latest level
- Java 1.4.2 SR12 is the latest level
While all of the Java versions will function and execute fine across the Power line, when using Power6, Java Version 6 is the recommended version for the most recent optimizations and exploitations.
32bit or 64bit
In general on Power systems, the operating system is specifically designed and optimized to run efficiently in either 32bit mode or 64bit mode. So with Java on Power, the primary performance consideration when using 64bit is the tradeoff between using a much larger address space and the processing of the 64bit pointers.
For most workloads across the Java versions, we recommend using the 32bit Java. If there's a requirement for a large address space, the 64bit Java will provide the support needed.
For some performance oriented workloads, for example SPECjbb2005, multiple JVMs are employed in parallel for the best performance.
Heap size
Interestingly enough, many out-of-the-box experiments by customers use a Java engine with only 256MB of memory. When working on optimizing performance, using larger heap sizes can make a significant difference in performance. Try experimenting with larger heaps of memory to judge the performance gains you will see. 256MB, 512MB, 768MB, 1024MB, etc.
As a trade-off balance point, it is recommended that the Java heap size be set lower than the amount of physical memory defined in the partition. You'll want to have enough available memory for the operating system, for other system processes, and for other JVM operations. Using too much of a system's memory is likely to result in paging of virtual memory to disk, most likely during garbage collection operations, leading to significant performance impacts.
We will add some examples of the default heap sizes across the three primary Java versions.
We will add an example of backing your heap with 16MB large pages (huge pages in Linux lingo).
Memory affinity
There are some tricks you can use to optimize the placement of memory with respect to processes and threads running on the cores. In general, this is used when you need squeeze out a little more performance, like published benchmarks.
We will add some examples on setting the affinity of the JVM to processor cores and other options.
SMT on
We generally recommend running your partition on Power systems with SMT on, especially on Power6 systems. Letting the hardware optimize the usage of the processor cores is almost always a good thing. For example, whenever a thread is temporarily stalled on the processor waiting for a memory fetch, the secondary thread can resume execution.
SPECjbb2005 recent example
The IBM Linux teams recently published a SPECjbb2005 result on a Power6 system
http://spec.org/jbb2005/results/res2008q4/jbb2005-20081006-00535.html
- IBM Corporation IBM Power 570 (4.2 GHz, 32 core)
- IBM Corporation J2RE 1.6.0 (32-bit) IBM J9 2.4 Linux (build pxp3260sr2-20080818_01)
- with Red Hat Enterprise Linux Advanced Platform 5.2 for IBM POWER (2.6.18.92.el5)
The Java command line parameters were specified as:
- numactl --physcpubind=n1,n2,n3,n4 --localalloc
- – -Xlp -Xgcpolicy:gencon -Xgcthreads4 -Xcompactgc -XlockReservation -Xnoloa -Xms3328m -Xmx3328m -Xmn3072m
We will add some descriptive text on these parameters and how they help optimize/tune performance.
Leverage shared processors
On Power systems, we generally recommend defining your partitions leveraging shared processors across the partitions. This is independent of Java, it's just a good thing to do on a system level.