JBoss profiling shows CPU increases using Sun JDK 1.6 vs. JRockit JDK 1.6

Solution Verified - Updated

Environment

  • JBoss Enterprise Application Platform (EAP)
  • Sun JDK 1.6
  • JRockit JDK 1.6

Issue

  • We are preparing a migration from WebLogic to JBoss, however, when running comparative stress tests on the following environment stacks:
  1. SUSE Linux Enterprise Server 10 (x86_64) VERSION = 10 PATCHLEVEL = 1
    JBoss EAP 4.3
    SUN JDK 1.6.0_18
  2. SUSE Linux Enterprise Server 10 (x86_64) VERSION = 10 PATCHLEVEL = 1
    JBoss EAP 4.3
    BEA JRockit JDK 1.6 (jrmc-3.1.2-1.6.0)
  • We find that running test and profiling the two different stacks using the same load and webpage (servlet) generates 73% higher CPU utilization using stack #1 compared with the alternative stack #2.
  • When profiling the application on the current stack using the same load and webpage (servlet) we can see the majority of CPU time is spent on native calls such as:
    java-lang.System.arraycopy()
    java.lang.String.intern()
    java.lang.ClassLoader.getPackage()

Resolution

Try another parser, or revise the code to minimize parsing.

Root Cause

Parsing using JAXB which results in a lot of interning using the com.sun.xml.bind.v2.runtime.unmarshaller.InterningXmlVisitor class, causing lock contention inside Sun's version of String.intern().

Diagnostic Steps

  • First tune the JVM and make sure the difference is not due to garbage collection.
  • Profile a repeatable test under both JDK 1.6 and JRockit 1.6 and compare the time difference and hot spots.
  • Test running on 1 cpu, where the results should be comparable if it is indeed a threading issue.
  • Test changing the code to avoid calls to System.arraycopy(), String.intern(), and ClassLoader.getPackage().
Tags

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.