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


Environment

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:

  1. Invoke the JVM 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.

Rate this page:

(0 users)Average rating

Add comments

Document information


More support for:

Runtimes for Java Technology
Hangs/Performance Degradation

Software version:

5.0, 6.0, 7.0, 7.1

Operating system(s):

Linux

Reference #:

1372909

Modified date:

2009-02-12

Translate my page

Machine Translation

Content navigation