Linux Completely Fair Scheduler affects Java performance

Technote (troubleshooting)


Problem(Abstract)

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.

Symptom

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.


Cause

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 J9 virtual machine.


Environment

This problem might affect IBM SDK, Java 2 Technology edition V5.0 and IBM SDK, Java Technology Edition, Version 6 (up to and including service refresh 4) 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:

  1. Invoke your Java application with the following additional argument:

    -Xthr:minimizeUserCPU

  2. 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.

    For example:

    echo "1" > /proc/sys/kernel/sched_compat_yield

You should not use these workarounds unless you are experiencing poor performance.

Note: From IBM SDK, Java Technology Edition Version 6 service refresh 5 and all later SDK releases, the use of CFS in the kernel is detected and options are enabled that invoke optimizations.

Document information


More support for:

Runtimes for Java Technology
Hangs/Performance Degradation

Software version:

5.0, 6.0

Operating system(s):

Linux

Reference #:

1372909

Modified date:

2009-02-12

Translate my page

Content navigation