Migrating Java Applications to HP-UX
35
Other Factors
This section discusses other factors that can affect the performance of your java application.
OS Scheduler
The scheduling policies in the OS can have a significant impact on heavily multi-threaded Java
applications. By default, the OS scheduling policy is SCHED_HPUX (or SCHED_TIMESHARE), where
the priority value of the thread is decayed over time as the thread consumes processor cycles and
boosted when the thread waits for processor cycles. If your application is experiencing performance
problems due to heavy lock contention among threads, you might see some improvement by changing
the scheduling policy to SCHED_NOAGE. The priority value of a thread executing with the
SCHED_NOAGE policy is not decayed or boosted by the operating system scheduler.
To switch the scheduling policy to SCHED_NOAGE, use the following JVM option:
XX:SchedulerPriorityRange=SCHED_NOAGE
Hyper-threading
If you are migrating your application to Intel(R) Itanium(R) processor 9300 series, you might see some
performance gain by enabling hyper-threading. Whereas enabling hyper-threading on the older
9100 series did not see much performance benefit, improvements to thread-switching decisions in the
9300 series make hyper-threading perform better. Whether or not you see a benefit depends on the
application, so experimentation is required.
To turn on hyper-threading, do the following:
1. Enable hyper-threading on your machine:
$setbootmon
$reboot
2. Dynamically turn on the hyper-threading tunable:
$kctunelcpu_attr=1
For more details, refer to the setboot and lcpu_attr man pages.
Other Java Options
• ForceMmapReserved
Some applications will see improved performance by using the option:
XX:+ForceMmapReserved
This option tells the JVM to reserve the swap space for all large memory regions used by the
JVM (Java heap).
• Java Exceptions
Exception handling in Java is very expensive, and processing an excessive number of
exceptions will cause non-optimal application performance. When migrating your application
from another platform, errors in deployment can cause exceptions to occur. For example,