Migrating Java Applications to HP-UX

30
Deployment of Java Instances and Processor Usage
Migrating Java applications to a different platform is often the result of upgrading hardware to a
newer processor and/or upgrading to a larger machine with more cores. If you were previously
running a single Java instance on a small box (e.g. 4-way), running that same single instance of Java
on a 32-way box may not give you the increased throughput you were expecting. To get optimal
performance, you may need to optimize the number of Java instances and assign these instances to
processor sets to improve locality.
To determine if you should utilize multiple Java instances and processor sets, here are some indicators
to look at:
Throughput or performance is not what you expected
Java process does not appear to be scaling with increased number of cores
Application is experiencing very high lock contention
Use glance and HPjmeter to analyze lock contention (see section “Thread Behavior and Lock
Contention” above)
CPU is very underutilized with the addition of more cores.
Use glance to observe.
Your application is experiencing sporadic high GC latencies
Use HPjmeter to look at GC duration.
Running multiple Java instances on larger machines versus a single Java instance has several
advantages:
Lock contention is potentially reduced.
Rather than all threads waiting on a single lock in a single instance, having multiple instances
essentially breaks up the single lock into multiple separate locks, thereby reducing lock
contention overall.
The effects of pause times for GCs can be reduced.
o As you try to increase the load on your system, with a single Java instance, you would
need to continue to increase the size of your heap to accommodate the increased object
creation rate. Assuming the basic garbage collector, increasing the total heap size
results in longer stop-the-world pause times when GC occurs. On the other hand, with
multiple instances of Java, each instance can have a smaller heap size since you have
multiple instances handling the increased load. The stop-the-world pause time for each
GC in a small instance would be less than with one huge instance.
o With the basic garbage collector, each time a GC occurs, all threads stop and are
brought to a safepoint. Then, GC occurs. If you have a single instance of Java, then the
entire instance is stopped waiting for GC to complete. With multiple instances, one Java
instance could be doing GC, but the others can continue to execute the actual
application.
Running multiple Java instances each in its own processor set offers additional advantages of
improved locality:
Ensures Java processes use local memory (cell-local or socket-local) for faster allocation and
memory access