Troubleshooting
Problem
Java applications that heavily use reflection might experience gradual performance slowdowns during thread initialization when Java command line option "-Xcompressedrefs" is enabled.
Cause
While using "-Xcompressedrefs", the JVM uses an internal memory sub-allocator that allocates memory below the 4GB virtual memory address. Certain types of JVM data must be allocated using the sub-allocator for performance and correctness.
When using "-Xcompressedrefs", memory is allocated using the sub-allocator to support the auto-generated reflection classes. After accommodating memory requirements for a lot of reflection, the sub-allocator takes longer to find free memory.
Resolving The Problem
There are two possible workarounds to overcome this issue:
- There are two possible workarounds to overcome this issue:
Set -Dsun.reflect.inflationThreshold to a value which yields performance improvement for the application. For more information on usage, please refer to link #1 in reference section below. When using this option, the observed regression in thread initialization is resolved since less memory is allocated for reflection using the sub-allocator. - Enable -Xnocompressedrefs. When -Xnocompressedrefs is used, the JVM does not use the sub-allocator. From Java 626 SR5 and Java 7 SR4, JVM uses -Xcompressedrefs as its default option. See the details below.
(Do not use these workarounds unless you are experiencing poor performance)
Please note,
- The -Xcompressedrefs option only applies to 64-bit versions of the JVM.
- This problem might affect all the platforms when -Xcompressedrefs is used.
- JVM option -Xcompressedrefs is enabled by default, except for z/OS®, from Java 626 SR5 and Java 7 SR4 when the value of the -Xmx option is less than or equal to 25 GB. On z/OS®, -Xcompressedrefs is enabled by default from Java 7.1 when the value of the -Xmx option is less than or equal to 25 GB.
- From Java 8 service refresh 2 fix pack 10, -Xcompressedrefs is enabled by default on all platforms except z/OS®, and except when -Xgcpolicy:metronome is specified, when the value of the -Xmx option is less than or equal to 57 GB.
- From Java 8 service refresh 3, compressed references are enabled by default on z/OS® when the value of the -Xmx option is less than or equal to 57 GB.
Related Information
Was this topic helpful?
Document Information
More support for:
Runtimes for Java Technology
Software version:
8.0, 7.1, 7.0, 6.1, 6.0
Operating system(s):
AIX, Linux, Windows, z/OS
Document number:
545939
Modified date:
15 June 2018
UID
swg21979693