directory
Some useful -xx options
Behavior choice
Garbage First (G1) Garbage collection options
Performance options
Debug options
Some abbreviations for the new version
Nohup deployment command
introduce
Version change
Some useful -xx options
For Solaris Sparc with -Server, Java SE 6 lists the defaults. Some options may vary by architecture/OS/JVM version. Platforms with different default values are listed in the description.
-XX:+<option>
use-XX:-<option>
.disa Turns on and off Boolean options- The numeric option is set to
-XX:<option>=<number>
. Numbers can include megabytes of “m” or “m,” kilobytes of “k” or “k,” and gigabytes of “G” or “G” (for example, 32K is the same as 32768). - The string option is set to
-XX:<option>=<string>
, usually used to specify a file, path, or command list
Mark as a sign of managed by the JDK management interface (com. Sun. Management HotSpotDiagnosticMXBean API) and dynamic write JConsole. In monitoring and managing Java SE 6 platform applications, the manageable flag can also be set through jinfo-flag. The following options fall into different categories.
- The behavior option changes the basic behavior of the VM.
- Garbage First (G1) Garbage collection options
- The performance tuning options are knobs that can be used to adjust VM performance.
- Debugging options can typically trace, print, or output VM information.
Behavior choice
Options and default values | describe |
---|---|
XX: — AllowUserSignalHandlers | Don’t complain if your application has a signal handler installed. (Related to Solaris and Linux only.) |
-xx: AltStackSize = 16384 | Standby signal stack size, in kilobytes. (Solaris only, removed from 5.0.) |
XX: — DisableExplicitGC | By default, calls to system.gc () are enabled (-xx: -disableexplicitGC). Use -xx: + DisableExplicitGC to disable calls to System.gc (). Note that the JVM still performs garbage collection when necessary. |
– XX: + FailOverToOldVerifier | Failover to the old validator when the new type checker fails. (Introduced in 6) |
– XX: + HandlePromotionFailure | The youngest generation series does not require full upgrades for all live objects. (Introduced in 1.4.2 Update 11) [5.0 and earlier: false.] |
– XX: + MaxFDLimit | Convert the number of file descriptors to the maximum. (Related to Solaris only.) |
-xx: PreBlockSpin = 10 | Rotation count variable for -xx: + UseSpinning. Controls the maximum rotation iteration allowed before entering the operating system thread synchronization code. (Introduced in 1.4.2.) |
XX: — RelaxAccessControlCheck | Relax access control checks in validators. (Introduced in 6) |
– XX: + ScavengeBeforeFullGC | Do the younger generation GC before the full GC. (Introduced in 1.4.1.) |
– XX: + UseAltSigs | For VM internal signals, alternate signals are used instead of SIGUSR1 and SIGUSR2. (Introduced in Update 1.3.1 9, 1.4.1. Related to Solaris only.) |
– XX: + UseBoundThreads | Bind user-level threads to kernel threads. (Related to Solaris only.) |
XX: — UseConcMarkSweepGC | Scan collections using concurrent tags for older generations. (Introduced in 1.4.1) |
– XX: + UseGCOverheadLimit | Use policies to limit the proportion of VM time spent in GC before OutOfMemory errors are raised. (Introduced in 6) |
– XX: + UseLWPSynchronization | Use LWP-based synchronization instead of thread-based synchronization. (Introduced in 1.4.0. Related to Solaris only.) |
XX: — UseParallelGC | Use parallel garbage collection cleanup. (Introduced in 1.4.1) |
XX: — UseParallelOldGC | Use parallel garbage collection for complete collections. Enabling this option automatically sets -xx: + UseParallelGC. (Introduced 6 in update 5.0.) |
XX: — UseSerialGC | Use serial garbage collection. (Introduced in 5.0.) |
XX: — UseSpinning | Enable naive rotation on the Java monitor before entering the operating system thread synchronization code. (Only relevant to 1.4.2 and 5.0.) [1.4.2, Multiprocessor Windows Platform: True] |
– XX: + UseTLAB | Use thread-local object allocation (introduced in 1.4.0 and previously called UseTLE). [1.4.2 and earlier, x86 or using -client: false] |
– XX: + UseSplitVerifier | Use a new type checker with StackMapTable attributes. (Introduced in 5.0.) [5.0: false] |
– XX: + UseThreadPriorities | Use native thread priority. |
– XX: + UseVMInterruptibleIO | OS_INTRPT is caused by an interruption of the thread that I/O before or with the EINTR. (Only introduced on Solaris. Related to Solaris only.) |
Garbage First (G1) Garbage collection options
Options and default values | describe |
---|---|
– XX: + UseG1GC | Use the garbage First (G1) collector |
– XX: MaxGCPauseMillis = n | Sets the target for the maximum GC pause time. This is a soft goal, and the JVM will do its best to achieve it. |
– XX: InitiatingHeapOccupancyPercent = n | Percentage of (total) heap used to start concurrent GC cycles. It is used by the GC and triggers concurrent GC cycles based on the occupancy of the entire heap rather than just one generation (for example, G1). A value of 0 means “perform a constant GC loop”. The default value is 45. |
– XX: NewRatio option = n | Old/new generation size ratio. The default value is 2. |
– XX: SurvivorRatio = n | Eden/survivor space size ratio. The default value is 8. |
– XX: MaxTenuringThreshold = n | The maximum lifetime critical value. The default value is 15. |
– XX: ParallelGCThreads = n | Sets the number of threads to use in the parallel phase of the garbage collector. Default values vary depending on the platform on which the JVM is running. |
– XX: ConcGCThreads = n | The number of threads that the concurrent garbage collector will use. Default values vary depending on the platform on which the JVM is running. |
-xx: G1ReservePercent = n | Set the number of heaps to remain capped at false to reduce the likelihood of promotion failures. The default value is 10. |
-xx: G1HeapRegionSize = n | With G1, the Java heap is subdivided into evenly sized regions. This sets the size of each subdepartment. The default value for this parameter is ergonomically determined based on the heap size. The minimum value is 1Mb, and the maximum value is 32Mb. |
Performance options
Options and default values | describe |
---|---|
– XX: + AggressiveOpts | Turn on the point performance compiler optimizations expected to default in upcoming releases. (Introduced 6 in update 5.0.) |
-xx: CompileThreshold = 10000 | Number of method calls/branches before compilation [-client: 1,500] |
-xx: LargePageSizeInBytes =4 m | Set the large page size for the Java heap. (Introduced in Update 1.4.0 1.) [AMD64:2m] |
-xx: MaxHeapFreeRatio = 70 | Maximum heap free percentage after GC to avoid shrinkage. |
-xx: MaxNewSize = Size | Maximum size (in bytes) of the new generation. Starting with 1.4, MaxNewSize is computed as a function of NewRatio. [1.3.1 Sparc: 32m; 1.3.1 x86:2.5m.] |
-xx: MaxPermSize =64 meters | The size of the permanent generation. [5.0 and later: 64-bit vm zoom 30%; 1.4AMD64:96M; 1.3.1-client: 32M.] |
-xx: MinHeapFreeRatio = 40 | Minimum heap percentage after GC to avoid scaling. |
-xx: NewRatio = 2 | Old/new generation size ratio. [SPARC-client: 8; x86-server: 8; x86-client: 12] – Client: 4 (1.3) 8 (1.3.1 +), x86:12] |
– XX: NewSize = 2 | Default size in bytes for the new generation [5.0 and later: 30% zoom for 64-bit VMS; x86:1 m; x86,5.0 and earlier: 640K] |
-xx: ReservedCodeCacheSize =32 m | Reserved code cache size in bytes – Maximum code cache size. [Solaris 64-bit, AMD64, and -Server x86:2048m; In 1.5.0_06 and earlier, Solaris 64-bit and AMD64:1024m. |
-xx: SurvivorRatio = 8 | Eden/Survivor space size ratio [Solaris AMD64:6;Sparc on 1.3.1:25; other Solaris platforms in 5.0 and earlier: 32] |
-xx: TargetSurvivorRatio = 50 | Percentage of survivor space required to be used after clearance. |
-xx: ThreadStackSize = 512 | Thread stack size in kilobytes. (0 means default stack size used) [Sparc: 512; Solaris x86:320 (before 256 in 5.0 and earlier); Sparc 64-bit: 1024;Linux AMD64:1024 (0 in 5.0 and earlier); all others 0.] |
– XX: + UseBiasedLocking | Enable bias locking. See here for more detailsAdjust the sample. (Introduced 6. In Update 5.0) [5.0:false] |
– XX: + UseFastAccessorMethods | Use the optimized version of Get Field. |
XX: — UseISM | Use intimate shared memory. [Not available on non-Solaris platforms.] For more information, seePrivate shared memory. |
– XX: + UseLargePages | Use large page memory. (Introduced in Update 5.0 5.) For more information, seeJava supports large memory pages. |
– XX: + UseMPSS | Use multi-page size support with 4MB pages. Do not use with ISM as this replaces the need for ISM. (Introduced in Update 1.4.0, related to Solaris 9 and later.) [1.4.1 and earlier: false] |
– XX: + UseStringCache | Enable caching of commonly assigned strings. |
-xx: AllocatePrefetchLines = 1 | The number of cached rows loaded by prefetch instructions generated in jIT-compiled code after the last object allocation. If the last allocated object is an instance, the default value is 1; If it is an array, the default is 3. |
-xx: AllocatePrefetchStyle = 1 | Code style for generating prefetch instructions. 0 – No prefetch instruction is generated * D *, 1 – prefetch instruction is executed after each allocation, 2 – TLAB is used to allocate watermark pointer to door when prefetch instruction is executed. |
– XX: + UseCompressedStrings | Use byte [] for strings, which can be represented as pure ASCII. (Introduced in the Java 6 Update 21 Performance release) |
– XX: + OptimizeStringConcat | Optimize string concatenation whenever possible. (Introduced in Java 6 Update 20) |
Debug options
Options and default values | describe |
---|---|
XX: — CITime | Print the time spent in the JIT compiler. (Introduced in 1.4.0.) |
-xx :ErrorFile= / hs_err_pid. log | If an error occurs, save the error data to this file. (Introduced in 6) |
XX: — ExtendedDTraceProbes | Enable performance affectingdtraceThe probe. (Only introduced on Solaris. Related to Solaris only.) |
-XX:HeapDumpPath = / java_pid .hprof | The path to the heap dump directory or file name.Can manage. (Introduced in Update 1.4.2 12 5.0 7.) |
XX: — HeapDumpOnOutOfMemoryError | Throw a Java. Lang. When an OutOfMemoryError heap dump file.Can manage. (Introduced in Update 1.4.2 12 5.0 7.) |
-xx: OnError = “;” | Run a user-defined command on a fatal error. (Introduced in Update 1.4.2 9) |
-xx: OnOutOfMemoryError = “;” | A user-defined command is run when OutOfMemoryError is first thrown. (introduced in 1.4.2 update 12,6) |
XX: — PrintClassHistogram | Print the histogram of the class instance on Ctrl-break.Can manage. (Introduced in 1.4.2.)jmap -histoThe command provides equivalent functionality. |
XX: — PrintConcurrentLocks | Print java.util.concurrent lock in ctrl-break thread dump.Can manage. (Introduced in 6.)jstack -lThe command provides equivalent functions. |
XX: — PrintCommandLineFlags | Prints flags that appear on the command line. (Introduced in 5.0.) |
XX: — PrintCompilation | The message is printed when the method is compiled. |
XX: — PrintGC | Print messages in garbage collection.Can manage. |
XX: — PrintGCDetails | Print more details in garbage collection.Can manage. (Introduced in 1.4.0.) |
XX: — PrintGCTimeStamps | Prints the timestamp of garbage collection.Can manage(Introduced in 1.4.0) |
XX: — PrintTenuringDistribution | Print lifetime age information. |
XX: — PrintAdaptiveSizePolicy | Allows you to print information about adaptive build sizes. |
XX: — TraceClassLoading | Track the loading of classes. |
XX: — TraceClassLoadingPreorder | Tracks all classes loaded in reference order (not loaded). (Introduced in 1.4.2.) |
XX: — TraceClassResolution | Track constant pool resolution. (Introduced in 1.4.2.) |
XX: — TraceClassUnloading | Trace unload classes. |
XX: — TraceLoaderConstraints | Track and record loader constraints. (Introduced in 6) |
– XX: + PerfDataSaveToFile | Save the jVMstat binary data on exit. |
– XX: ParallelGCThreads = n | Sets the number of garbage collection threads in the young and old parallel garbage collectors. Default values vary depending on the platform on which the JVM is running. |
– XX: + UseCompressedOops | Compression Pointers are allowed (object references are represented as 32-bit offsets instead of 64-bit Pointers) to optimize 64-bit performance, and the Java heap size is less than 32GB. |
– XX: + AlwaysPreTouch | Pre-touch the Java heap during JVM initialization. Therefore, each page of the heap is requirement zero during initialization, rather than incrementing during application execution. |
– XX: AllocatePrefetchDistance = n | Set the prefetch distance allocated to an object. Memory written with the value of the new object is prefetched into the cache in bytes beyond the address of the last allocated object. Each Java thread has its own allocation point. Default values vary depending on the platform on which the JVM is running. |
– XX: InlineSmallCode = n | Native code generated by a previously compiled method is inlined only if it is smaller than this value. Default values vary depending on the platform on which the JVM is running. |
-xx: MaxInlineSize = 35 | The maximum bytecode size of the method to be inlined. |
– XX: FreqInlineSize = n | The maximum bytecode size for frequently executed methods to be inlined. Default values vary depending on the platform on which the JVM is running. |
– XX: LoopUnrollLimit = n | Expand the body of the loop and the server compiler intermediate indicates that the node count is less than this value. The limit used by the server compiler is a function of this value, not the actual value. Default values vary depending on the platform on which the JVM is running. |
-xx: InitialTenuringThreshold = 7 | Sets the initial aging threshold for adaptive GC resizing in a parallel young collector. The termination threshold is the number of times an object can survive in a young set before being promoted to an old or lifetime generation. |
– XX: MaxTenuringThreshold = n | Sets the maximum tentative threshold for adaptive GC resizing. The current maximum value is 15. The default value for the parallel collector is 15, and the default value for CMS is 15. |
-xloggc: < file name > | Logs the GC verbose output to the specified file. Verbose output is controlled by the normal verbose GC flag. |
XX: — UseGCLogFileRotation | To enable GC log rotation, -xloggc is required. |
-xx: NumberOfGClogFiles = 1 | To set the number of files to use when rotating logs, you must > = 1. Rotating log files will use the following naming scheme,.0,.1,… ,. N – 1. |
-xx: GCLogFileSize = 8K | When the log will be rotated the log file size must be > = 8K. |
These are all the options that the JVM can adjust
ok
Some abbreviations for the new version
The parameter name | Meaning Default Value |
---|---|
-Xms | Initial heap size 1/64 of physical memory (<1GB) Default (the MinHeapFreeRatio parameter can be adjusted) When the free heap is less than 40%, the JVM increases the heap to the -xmx maximum limit. |
-Xmx | Maximum heap size 1/4 of physical memory (<1GB) Default (the MaxHeapFreeRatio parameter can be adjusted) When free heap memory is greater than 70%, the JVM reduces the heap to the minimum limit of -xms |
-Xmn | Young generation size (1.4or lator) Note: The size here is (Eden + 2 survivor space). This is different from the New Gen shown in Jmap-heap. Total heap size = young generation size + Old generation size + persistent generation size. When you increase the young generation, you decrease the size of the old generation. This value has a significant impact on system performance. Sun officially recommends setting it to 3/8 of the entire heap |
-XX:NewSize | Set young generation size (for 1.3/1.4) |
-XX:MaxNewSize | Maximum young generation (for 1.3/1.4) |
-XX:PermSize | Set perm gen to 1/64 of the initial physical memory |
-XX:MaxPermSize | Set the persistent generation to 1/4 of the maximum physical memory |
-Xss | Stack size per thread, 1M per thread after JDK5.0, 256K per thread before. The size of memory required by more applied threads is adjusted. Reducing this value generates more threads for the same physical memory. However, the operating system has a limit on the number of threads in a process, which cannot be generated indefinitely. The experience value is about 3000~5000. Generally, for small applications, if the stack is not very deep, it should be 128K enough. This option has a significant impact on performance and requires rigorous testing. (Principal) is similar to the interpretation of the Threadstacksize option. The official documentation does not seem to explain this. In the forum, there is a sentence like this :” -Xss is translated in a VM flag named Threadstacksize “. |
-XX:ThreadStackSize | Thread Stack Size (0 means use default stack size) [Sparc: 512; Solaris x86: 320 (was 256 prior in 5.0 and earlier); Sparc 64 bit: 1024; Linux AMD64:1024 (was 0 in 5.0 and earlier); All Others 0.] |
-XX:NewRatio | -xx :NewRatio=4 Indicates that the ratio of the young generation to the old generation is 1:4. The young generation accounts for 1/5xms =Xmx and Xmn is set. This parameter does not need to be set. |
-XX:SurvivorRatio | If the size ratio of Eden zone to Survivor zone is set to 8, the ratio of two Survivor zones to one Eden zone is 2:8, and one Survivor zone accounts for 1/10 of the whole young generation |
-XX:LargePageSizeInBytes | Do not set the size of the memory page to too large, which will affect the Perm size =128 MB |
-XX:+UseFastAccessorMethods | Quick optimization of primitive types |
-XX:+DisableExplicitGC | Turning off system.gc () requires rigorous testing |
-XX:MaxTenuringThreshold | If the maximum garbage age is set to 0, the young generation object passes through the Survivor zone and directly enters the old generation. For the older generation of more applications, can improve efficiency. If set to a large value, the young generation object will be copied multiple times in Survivor zones, increasing the lifetime of the object in the young generation and increasing the probability that it will be collected in the young generation. This parameter is only valid for serial GC. |
-XX:+AggressiveOpts | To speed up compilation |
-XX:+UseBiasedLocking | Locking mechanism performance improvements |
-Xnoclassgc | Disable garbage collection |
-XX:SoftRefLRUPolicyMSPerMB | 1s appear reachable objects will remain alive for some amount of time after the last time they were referenced. The default value is one second of lifetime per free megabyte in the heap |
-XX:PretenureSizeThreshold | An object larger than the size of the exploiter is allocated directly on the exploiter. The Parallel Exploiter is invalid when the exploiter is used. Another way to allocate an object directly on the exploiter is to have an array object that is large and has no external reference objects in the array. |
-XX:TLABWasteTargetPercent | TLAB accounts for 1% of Eden District |
-XX:+CollectGen0First | FullGC: YGC false |
ok
Nohup deployment command
$ java -jar -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=128m -Xms1024m -Xmx1024m -Xmn256m -Xss256k -XX:SurvivorRatio=8 - XX: + UseConcMarkSweepGC xxooporject - 1.0.0. JarCopy the code
- $ java -jar -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=128m -Xms1024m -Xmx1024m -Xmn256m -Xss256k -XX:SurvivorRatio=8 – XX: + UseConcMarkSweepGC xxooporject – 1.0.0. Jar
introduce
-xx :MetaspaceSize= 128M (default size of the metasspace) -xx :MaxMetaspaceSize= 128M (maximum size of the metasspace) -xMS1024m (maximum size of the heap) -XMX1024M (default size of the heap) -xmn256m (Xss256k) -xx :SurvivorRatio=8 (Xss256k) -xx :+UseConcMarkSweepGC (specify used garbage collector, CMS collector is used here) -xx :+PrintGCDetails (Prints verbose GC logs)
Version change
-xx :PermSize and -xx :MaxPermGen removed from JDK8 Instead, -xx :MetaspaceSize= 128M (default size) -xx :MaxMetaspaceSize= 128M (maximum size) JDK 8 started putting class metadata in the native heap. This area is called Metaspace, or Metaspace in Chinese. What are the benefits of using localized memory? The most direct performance is Java. Lang. OutOfMemoryError: The PermGen space problem is eliminated, because the default class metadata allocation is only limited by the size of the local memory, which means that Metaspace can theoretically be as large as the remaining local memory. It’s not clear here), which solves the space problem. However, it is obviously unrealistic to make Metaspace infinitely large, so we will also limit the size of Metaspace: use the -xx :MaxMetaspaceSize parameter to specify the size of the Metaspace region. By default, the JVM dynamically sets the size of MaxMetaspaceSize at run time as needed.
Continuously updated