Most Frequently Used JVM Parameters

Most Frequently Used JVM Parameters

  • perf-test.com need your contributions to build up a strong repository of performance engineering resources.

Command line options that toggle on or off a feature or attribute of the HotSpot VM have the form -XX:<+|−>FeatureName where + indicates enable the feature and − indicates disable the feature. Command line options that require a numerical value have the form

-XX:FeatureName=<n> where n is some numerical value. All command line options that require a numerical value that controls the size of some attribute in kilobytes, megabytes, or gigabytes accept the following suffixes: g, m, k. Other command line options require a numerical value to express a ratio or a percentage.

-client
Specifies that the HotSpot VM should optimize for client applications. At the present time, this option results in the use of the client JVM as the runtime environment.This command line option should be used when application startup time and small memory footprint are the most important performance criteria for the application,much more important than high throughput.

-server
Specifies that the HotSpot VM should optimize for server applications. At the present time, this option results in the use of the server JVM as the runtime environment.This command line option should be used when high application throughput is more important than startup time and small memory footprint.

-d64
Loads the 64-bit HotSpot VM instead of the default HotSpot 32-bit VM. This command line option should be used when there is a need to use a larger Java
heap size than is possible with a 32-bit HotSpot VM. -XX:+UseCompressedOops should also be used in conjunction with this command line option for -Xmx and -Xms values less than 32 gigabytes. HotSpot versions later than Java 6 Update 18 enable -XX:+UseCompressedOops by default. Also see -XX:+UseCompressedOops.

-XX:+UseCompressedOops
Enables a feature called compressed oops. Oops stands for ordinary object pointer, which is the means by which the HotSpot VM represents a reference to a Java object internally.64-bit JVMs come with a performance penalty due to an increase in the size of Java references from 32 bits to 64 bits. This increase in width results in fewer ordinary object pointers being available on a CPU cache line, and as a result decreases CPU cache efficiency. The decrease in CPU cache efficiency on 64-bit JVMs often results in about an 8% to 20% performance degradation compared to a 32-bit JVM.

-XX:+UseCompressedOops can yield 32-bit JVM performance with the benefit of larger 64-bit JVM heaps. Some Java applications realize better performance with a 64-bit HotSpot VM using compressed oops than with a 32-bit HotSpot VM. The performance improvement realized from compressed oops arises from being able to transform a 64-bit pointer into a 32-bit offset from a Java heap base address. Useful when you want a Java heap larger than what can be specified for a 32-bit HotSpot VM but are not willing to sacrifice 32-bit VM performance. It should be used when specifying a Java heap up to 32 gigabytes (-Xmx32g), though best performance is realized up to about 26 gigabytes (-Xmx26g). Also see -d64.

-Xms<n>[g|m|k]
The initial and minimum size of the Java heap, which includes the total size of the young generation space and old generation space. <n> is the size. [g|m|k] indicates whether the size should be interpreted as gigabytes, megabytes, or kilobytes. The Java heap will never be smaller than the value specified for -Xms. When -Xms is smaller than -Xmx, the size of Java heap may grow or contract depending on the needs of the application. However, growing or contracting the Java heap requires a full garbage collection. Applications with a focus on latency or throughput performance tend to set -Xms and -Xmx to the same value.

-Xmx<n>[g|m|k]
The maximum size of the Java heap, which includes the total size of the young generation space and old generation space. <n> is the size. [g|m|k] indicates whether the size should be interpreted as gigabytes, megabytes, or kilobytes. The Java heap will never grow to more than the value specified for -Xmx.When -Xmx is larger than -Xms, the size of Java heap may grow or contract depending on the needs of the application. However, growing or contracting the Java heaprequires a full garbage collection. Applications with a focus on latency or throughput performance tend to set -Xms and -Xmx to the same value.

-XX:NewSize=<n>[g|m|k]
The initial and minimum size of the young generation space. <n> is the size. The young generation space will never be smaller than the value specified. When -XX:NewSize is smaller than -XX:MaxNewSize, the size of the young generation space may grow or contract depending on the needs of the application. However, growing or contracting the young generation space requires a full garbage collection. Applications with a focus on latency or throughput performance tend to set -XX:NewSize and -XX:MaxNewSize to the same value.

-XX:MaxNewSize=<n>[g|m|k]
The maximum size of the young generation space. <n> is the size. [g|m|k] indicates whether the size should be interpreted as gigabytes, megabytes, or kilobytes. The young generation space will never be larger than the value specified.When -XX:MaxNewSize is larger than -XX:NewSize, the size of the young generation space may grow or contract depending on the needs of the application.However, growing or contracting the young generation space requires a full garbage collection. Applications with a focus on latency or throughput performance tend to set -XX:MaxNewSize and -XX:NewSize to the same value.

-Xmn<n>[g|m|k]
Sets the initial, minimum, and maximum size of the young generation space. <n> is the size. [g|m|k] indicates whether the size should be interpreted as gigabytes, megabytes, or kilobytes. The young generation space size will be set to the value specified. A convenient shortcut command line option to use when it is desirable to set -XX:NewSize and -XX:MaxNewSize to the same value.

-XX:NewRatio=<n>
The ratio between the young generation space size and old generation space size. For example, if n is 3, then the ratio is 1:3, and the young generation space size is onefourth
of the total size of young generation space and old generation space. The ratio of the sizes of both young generation space and old generation space are maintained if the Java heap grows or contracts.

Reference : Java Performance Book by 'Charlie Hunt' and 'Binu John'.
Author
Vaibhav
Views
46
First release
Last update
Rating
0.00 star(s) 0 ratings