Java applications that use synchronization extensively might perform poorly on Linux distributions that include the Completely Fair Scheduler. If you encounter this problem, there are two possible workarounds.
You might observe extremely high CPU usage by your Java application, and very slow progress through synchronized blocks. The application might appear to hang due to the slow progress.
The Completely Fair Scheduler (CFS) is a scheduler that was adopted into the mainline Linux kernel as of release 2.6.23. The CFS algorithm is different from previous Linux releases. It might change the performance properties of some applications. In particular, CFS implements sched_yield() differently, making it more likely that a thread that yields will be given CPU time regardless.
The new behavior of sched_yield() might adversely affect the performance of synchronization in the IBM JVM.
This problem might affect IBM JDK 5.0 and 6.0 (all versions) running on Linux kernels that include the Completely Fair Scheduler.
Some Linux distributions that include the Completely Fair Scheduler are:
- Ubuntu 8.04
- SUSE Linux Enterprise Server 11
Resolving the problem
If you observe poor performance of your Java application, there are two possible workarounds:
- Invoke the JVM with the following additional argument:
- Configure the Linux kernel to use the more backward-compatible heuristic for sched_yield(), by setting the sched_compat_yield tunable kernel property to 1.
echo "1" > /proc/sys/kernel/sched_compat_yield
You should not use these workarounds unless you are experiencing poor performance.