Java options-some useful-xx options

Source: Internet
Author: User
Document directory
  • Categories of Java hotspot VM options
  • Some useful-xx options
Http://java.sun.com/javase/technologies/hotspot/vmoptions.jsp
Categories of Java hotspot VM options

 

Standard options recognized by the Java hotspot VM are described on the Java application launcher reference pages for Windows

, Solaris

And Linux

. This document deals exclusively with non-standard options recognized by the Java hotspot VM:

  • Options that begin-X

    Are non-standard (not
    Guaranteed to be supported on All VM implementations), and are Subject
    To change without notice in subsequent releases of the JDK.

  • Options that are specified-XX

    Are not stable and are not recommended for casual use. These options are subject to change without notice.

 

Some useful-xx options

 

Default values are listed for Java SE 6 for Solaris iSCSI with-server.
Some options may vary per architecture/OS/JVM version. Platforms with
Differing default value are listed in the description.

  • Boolean options are turned on-XX:+<option>

    And turned off-XX:-<option>

    .

  • Numeric options are set -XX:<option>=<number>

    .
    Numbers can include 'M' or 'M' for megabytes, 'K' or 'K' for kilobytes,
    And 'g' or 'G' for gigabytes (for example, 32 K is the same as 32768 ).

  • String options are set-XX:<option>=<string>

    , Are usually used to specify a file, a path, or a list of commands

Flags markedManageable

Are dynamically writeable
Through the JDK Management Interface
(COM. Sun. Management. hotspotdiagnosticmxbean API) and also through
Jconsole. in monitoring and managing Java SE 6 platform applications

, Figure 3 shows an example. The manageable flags can also be set through jinfo-flag

.

The options below are loosely grouped into three categories.

  • Behavioral options

    Change the basic behavior of the VM.

  • Performance Tuning

    Options are knobs which can be used to tune VM performance.

  • Debugging options

    Generally enable tracing, printing, or output of VM information.

 

Behavioral options

 

Option and default value Description
-XX:-allowusersignalhandlers Do not complain if the application instils signal handlers. (relevant to Solaris and Linux only .)

-XX: altstacksize = 16384 Alternate signal stack size (in Kbytes). (relevant to Solaris only, removed from 5.0 .)

-XX:-disableexplicitgc Disable callto system. GC (), JVM still performs garbage collection when necessary.

-XX: + failovertooldverifier Fail over to old verifier when the new type checker fails. (introduced in 6 .)

-XX: + handlepromotionfailure The youngest generation collection does not require a guarantee of full promotion of all live objects. (introduced in 1.4.2
Update 11) [5.0 and earlier: false.]

-XX: + maxfdlimit Bump the number of file descriptors to max. (relevant
To Solaris only .)

-XX: preblockspin = 10 Spin count variable for use with-XX: + usespinning. controls
Maximum spin iterations allowed before entering operating system thread
Synchronization Code. (introduced in 1.4.2 .)

-XX:-relaxaccesscontrolcheck Relax the access control checks in the verifier. (introduced
In 6 .)

-XX: + scavengebeforefullgc Do young generation GC prior to a full GC. (introduced in 1.4.1 .)

-XX: + usealtsigs Use alternate Signals instead of SIGUSR1 and sigusr2 for VM
Internal signals. (introduced in 1.3.1 update 9, 1.4.1. Relevant
Solaris only .)

-XX: + useboundthreads Bind user level threads to kernel threads. (relevant
Solaris only .)

-XX:-useconcmarksweepgc Use concurrent mark-sweep collection for the old generation.
(Introduced in 1.4.1)

-XX: + usegcoverheadlimit Use a policy that limits the proportion of the VM's time that is
Spent in GC before an outofmemory error is thrown. (introduced in 6 .)

-XX: + uselwpsynchronization Use lwp-based instead of thread based synchronization. (introduced in 1.4.0. Relevant to Solaris only .)

-XX:-useparallelgc Use parallel garbage collection for scavenges. (introduced in 1.4.1)

-XX:-useparalleloldgc Use parallel garbage collection for the full collections. Enabling
This option automatically sets-XX: + useparallelgc. (introduced in 5.0
Update 6 .)

-XX:-useserialgc Use Serial garbage collection. (introduced in 5.0 .)

-XX:-usespinning Enable naive spinning on Java monitor before entering operating
System thread synchronizaton code. (relevant to 1.4.2 and 5.0 only .)
[1.4.2, multi-processor Windows platforms: True]

-XX: + usetlab Use thread-local object allocation (introduced in 1.4.0, known
Usetle prior to that.) [1.4.2 and earlier, x86 or with-Client: false]

-XX: + usesplitverifier Use the new
Type Checker with stackmaptable attributes. (introduced in 5.0.) [5.0: false]

-XX: + usethreadpriorities Use native thread priorities.

-XX: + usevminterruptibleio Thread interrupt before or with eintr for I/O operations results in OS _intrpt. (introduced in 6. Relevant to Solaris only .)


Back to options

 

Performance options

 

Option and default value Description
-XX: + aggressiveopts Turn on point performance compiler optimizations that are expected
To be default in upcoming releases. (introduced in 5.0 Update 6 .)

-XX: compilethreshold = 10000 Number of method invocations/branches before compiling [-Client: 1,500]

-XX: largepagesizeinbytes = 4 m Sets the large page size used for the Java heap. (introduced in 1.4.0 update 1.) [amd64: 2 M.]

-XX: maxheapfreeratio = 70 Maximum percentage of heap free after GC to avoid shrinking.

-XX: maxnewsize = size Maximum size of New Generation (in bytes). Since 1.4, maxnewsize is
Computed as a function of newratio. [1.3.1 iSCSI: 32 m; 1.3.1 x86:
2.5 m.]

-XX: maxpermsize = 64 m Size of the permanent generation. [5.0 and newer: 64 bit VMS are scaled 30% larger; 1.4 amd64: 96 m; 1.3.1-Client: 32 M.]

-XX: minheapfreeratio = 40 Minimum Percentage of heap free after GC to avoid expansion.

-XX: newratio = 2 Ratio of new/old generation sizes. [iSCSI-Client: 8; x86-server: 8; x86-Client: 12.] -Client: 4 (1.3) 8 (1.3.1 +), x86: 12]

-XX: newsize = 2.125 m Default size of New Generation (in bytes) [5.0 and newer: 64 bit VMS are scaled 30% larger; x86: 1 m; x86, 5.0 and older: 640 K]

-XX: reservedcodecachesize = 32 m Reserved code cache size (in bytes)-maximum code cache size.
[Solaris 64-bit, amd64, and-server x86: 48 m; In 1.5.0 _ 06 and earlier,
Solaris 64-bit and and64: 1024 M.]

-XX: Required vorratio = 8 Ratio of Eden/mirror vor space size [Solaris amd64: 6; iSCSI in 1.3.1: 25; other Solaris platforms in 5.0 and earlier: 32]

-XX: target1_vorratio = 50 Desired percentage of specified vor space used after scavenge.

-XX: thread stacksize = 512 Thread stack size (in Kbytes). (0 means use default stack size)
[ISCSI: 512; Solaris x86: 320 (was 256 prior in 5.0 and earlier );
64 bit: 1024; Linux amd64: 1024 (was 0 in 5.0 and earlier); All
Others 0.]

-XX: + usebiasedlocking Enable biased locking. For more details, see this Tuning
Example

. (Introduced in 5.0 Update 6.) [5.0: false]

-XX: + usefastaccessormethods Use optimized versions of get <primitive> field.

-XX:-useism Use intimate shared memory. [not accepted for non-Solaris
Platforms.] For details, see intimate shared memory

.

-XX: + uselargepages Use large page memory. (introduced in 5.0 Update 5.) For details, see Java support for large memory
Pages

.

-XX: + usempss Use multiple page size support W/4 MB pages for the heap. Do not use
With ism as this replaces the need for ism. (introduced in 1.4.0 update
1, relevant to Solaris 9 and newer.) [1.4.1
And earlier: false]

-XX: + stringcache Enables caching of commonly allocated strings.

-XX: allocateprefetchlines = 1 Number of cache lines to load after the last object allocation
Using prefetch instructions generated in JIT compiled code. Default
Values are 1 if the last allocated object was an instance and 3 if it
Was an array.

-XX: allocateprefetchstyle = 1 Generated code style for prefetch instructions.

0-No prefetch instructions are generate * D *,

1-Execute prefetch instructions after each allocation,

2-Use tlab allocation watermark pointer to gate when prefetch instructions are executed.


Back to options

 

Debugging options

 

Option and default value Description
-XX:-citime Prints time spent in JIT compiler. (introduced in 1.4.0 .)

-XX: errorfile =./hs_err_pid <pid>. Log If an error occurs, save the error data to this file. (introduced in 6 .)

-XX:-extendeddtraceprobes Enable performance-impacting dtrace

Probes. (introduced in 6.
Relevant to Solaris only .)

-XX: heapdumppath =./java_pid <pid>. hprof Path to directory or filename for heap dump.Manageable

.
(Introduced in 1.4.2 update 12, 5.0 Update 7 .)

-XX:-heapdumponoutofmemoryerror Dump heap to file when java. Lang. outofmemoryerror is thrown.Manageable

.
(Introduced in 1.4.2 update 12, 5.0 Update 7 .)

-XX: onerror = "<cmd ARGs>; <cmd ARGs>" Run user-defined commands on fatal error. (introduced in
1.4.2 update 9 .)

-XX: onoutofmemoryerror = "<cmd ARGs>;

<Cmd ARGs>"

Run user-defined commands when an outofmemoryerror is first thrown. (introduced in 1.4.2 update 12, 6)

-XX:-printclasshistogram Print a histogram of class instances on CTRL-break.Manageable

. (Introduced in 1.4.2.) The jmap-histo

Command provides equivalent functionality.

-XX:-printconcurrentlocks Print java. util. Concurrent locks in ctrl-break thread dump.Manageable

.
(Introduced in 6.) The jstack-l

Command provides equivalent functionality.

-XX:-printcommandlineflags Print flags that appeared on the command line. (introduced in 5.0 .)

-XX:-printcompilation Print message when a method is compiled.

-XX:-printgc Print messages at garbage collection.Manageable

.

-XX:-printgcdetails Print more details at garbage collection.Manageable

. (Introduced in 1.4.0 .)

-XX:-printgctimestamps Print timestamps at garbage collection.Manageable

(Introduced in 1.4.0 .)

-XX:-printtenuringdistribution Print tenuring age information.

-XX:-traceclassloading Trace loading of classes.

-XX:-traceclassloadingpreorder Trace all classes loaded in order referenced (not loaded ).
(Introduced in 1.4.2 .)

-XX:-traceclassresolution Trace constant pool resolutions.
(Introduced in 1.4.2 .)

-XX:-traceclassunloading Trace unloading of classes.

-XX:-traceloaderconstraints Trace recording of Loader constraints.
(Introduced in 6 .)

-XX: + perfsavedatatofile Saves jvmstat binary data on exit.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.