This article is a mirror article of machine translation, please click here to jump to the original article.

View: 17284|Reply: 1

[Source] JVM parameters Options

[Copy link]
Posted on 2020-8-31 22:20:25 | | |
We divide the JVM parameters into three parts based on the JVM parameters starting with -X or -XX:
1. Starting with -, the standard VM option, the VM specification option;
2. Those that start with -X are non-standard (these parameters are not guaranteed to be implemented on all JVMs), and if there are any changes in the new version, no notification will be issued.
3. Those that start with -XX are unstable and not recommended for use in production environments. Changes to these parameters will also not be notified. Bool parameter options: -XX:+ on, -XX:- off. (e.g. -XX:+PrintGCDetails) The numeric parameter option is set by -XX:=. Numbers can be m/m (megabytes), k/k (kilobytes), g/g (g-bytes). For example: 32K means 32768 bytes. (e.g. -XX:MaxPermSize=64m) The String parameter option is set by -XX:=, which is usually used to specify a file, path, or command list. (e.g. -XX:HeapDumpPath=./java_pid.hprof) command java -help can list the standard options for java application startup (see Appendix Standard VM Parameter Table, different JVM implementations are different). java -X can list non-standard parameters (which is an extension of the JVM). -X related options are not standard and will not be notified if they are changed. If you want to see the JVM parameters currently used by your application, you can use: ManagementFactory.getRuntimeMXBean().getInputArguments().

Parameter NamemeaningDefaults/Notes
-XmsInitial heap size1/64 (<1GB) of physical memory By default (MinHeapFreeRatio parameter can be adjusted) When the free heap memory is less than 40%, the JVM will increase the heap until the maximum limit of -Xmx
-XmxMaximum heap size1/4 of the physical memory (<1GB) default (MaxHeapFreeRatio parameter can be adjusted) When the free heap memory is greater than 70%, the JVM will reduce the heap until the minimum limit of -xms
-XmnGeneration size (JDK 1.4 or above)After increasing the new generation, the size of the old generation will be reduced. This value has a significant impact on system performance. Sun officially recommends the configuration to 3/8 of the entire stack
-XssThe stack size of each threadAfter JDK5.0, each thread stack size was 1M, and previously each thread stack size was 256K, which can be in K, M, or G units
-XX:ThreadStackSizeIbid0 means the default value is used, and it cannot be united
-XX:PermSizeSet the permanent algebra initial value1/64 of the physical memory
-XX:MaxPermSizeSet the permanent generation maximum1/4 of the physical memory
-XX:NewRatioRatio of Cenozoic (including Eden and two Survivor zones) to Old Age (excluding permanent generation)-XX:NewRatio=4 means that the ratio of the Cenozoic to the Old Age is 1:4, and the Cenozoic accounts for 1/5 of the entire stack, Xms=Xmx and Xmn is set, this parameter does not need to be set.
-XX:SurvivorRatioThe size ratio of the Eden area to the Survivor areaIf set to 8, the ratio of two Survivor regions to one Eden region is 2:8, and one Survivor region accounts for 1/10 of the entire Cenozoic
-XX:LargePageSizeInBytesThe size of the memory page should not be set too large, as it will affect the size of the Perm=128m
-XX:+UseFastAccessorMethodsQuick optimization of the original type
-XX:+DisableExplicitGCClose System.gc()This parameter requires rigorous testing
-XX:MaxTenuringThresholdMaximum age of garbageIf set to 0, the new generation object will enter the old era directly without passing through the Survivor area. For older applications, efficiency can be improved. If this value is set to a large value, the new generation object will be copied multiple times in the Survivor region, which can increase the survival time of the object in the new generation and increase the probability of being recycled in the new generation, which is only valid for serial GC
-XX:+AggressiveOptsSpeed up compilation
-XX:+UseBiasedLockingPerformance improvements for locking mechanisms
-XnoclassgcDisable garbage recycling
-XX:SoftRefLRUPolicyMSPerMBThe survival time of SoftReference per megapile of free space1s
-XX:PretenureSizeThresholdThe size of the object is directly distributed in old ageAnother case where the new generation uses Parallel Scavenge GC is invalid, and another case where it is directly assigned in the old age is a large array object with no external reference objects in the array.
-XX:TLABWasteTargetPercentPercentage of TLAB in the Eden area1%
-XX:+CollectGen0FirstWhether YGC comes first when FullGCfalse
-XX:+UseParallelGCFull GC uses parallel MSCSee [GC Parameters][1]
-XX:+UseParNewGCSetting the new generation to collect in parallelIt can be used in conjunction with CMS collection, JDK 5.0 or later, and the JVM will set it according to the system configuration, so there is no need to set this value again
-XX:ParallelGCThreadsThe number of threads for the parallel collectorThis value is best configured equal to the number of processors, and is also suitable for CMS
-XX:+UseParallelOldGCThe old garbage collection method is Parallel CompactingThis is the parameter option that appears in JAVA 6
-XX:MaxGCPauseMillisMaximum time per new generation waste collection (maximum pause time)If this time cannot be met, the JVM will automatically resize the new generation to meet this value.
-XX:+UseAdaptiveSizePolicyAutomatically select the size of the new generation area and the corresponding ratio of the survivor areaWhen this option is set, the parallel collector automatically selects the size of the new generation area and the corresponding proportion of the survivor area to achieve the minimum corresponding time or collection frequency specified by the target system
-XX:GCTimeRatioSet the garbage collection time as a percentage of the program's running timeThe formula is 1/(1+n)
-XX:+ScavengeBeforeFullGCFull GC before calling YGCtrue
-XX:+UseConcMarkSweepGCUse CMS memory collectionAfter configuring this in the test, the configuration of -XX:NewRatio=4 is invalid, and the reason is unknown, so it is best to use -Xmn to set the size of the new generation at this time
-XX:+AggressiveHeapThe attempt is to use a lot of physical memoryOptimization of long-term large memory usage, can check computing resources (memory, number of processors, at least 256MB of memory) is required
-XX:CMSFullGCsBeforeCompactionHow many times do memory compression occur?Since the concurrent collector does not compress and organize the memory space, it will produce "fragmentation" after running for a period of time, which reduces the operation efficiency
-XX:+CMSParallelRemarkEnabledLower marker pauses
-XX+UseCMSCompactAtFullCollectionCompression of the old age when it was FullGCCMS does not move memory, so it is very easy to produce fragmentation, resulting in insufficient memory, so memory compression will be enabled at this time. It is a good habit to increase this parameter. It may affect performance, but it can eliminate debris
-XX:+UseCMSInitiatingOccupancyOnlyStart CMS collection with manual definition initializationHostSpot is prohibited from triggering CMS GC on its own
-XX:CMSInitiatingOccupancyFraction=70CMS collection begins after 70% of the garbage is used as garbage recyclingThis value needs to be set to meet the following formula, CMSInitiatingOccupancyFraction
-XX:CMSInitiatingPermOccupancyFractionSet the Perm Gen usage to trigger when the ratio is reached92
-XX:+CMSIncrementalModeSet to Incremental modeUsed in single-CPU cases
-XX:+CMSClassUnloadingEnabledPermanent CMS GC
-XX:+PrintGCGC log outputSame as -verbose:gc
-XX:+PrintGCDetailsIbidMore details
-XX:+PrintGCTimeStampsOutput GC timestampUse it with the above PrintGC parameter, or write something like -XX:+PrintGC:PrintGCTimeStamps
-XX:+PrintGC:PrintGCTimeStampsCan be mixed with -XX:+PrintGC -XX:+PrintGCDetails
-XX:+PrintGCApplicationStoppedTimeThe time the program pauses during print garbage collection. Can be mixed with the aboveOutput format: Total time for which application threads were stopped: 0.0468229 seconds
-XX:+PrintGCApplicationConcurrentTimePrint the uninterrupted execution time of the program before each garbage collectionCan be mixed with the above, output form: Application time: 0.5291524 seconds
-XX:+PrintHeapAtGCPrint detailed stack information before and after GC
-Xloggc:filenameLog the relevant log information to a file for analysisWorks with the above few
-XX:+PrintClassHistogramAfter pressing Ctrl+Break in the console, print the class information
-XX:+PrintClassHistogramBeforeFullGCFullGC before printing
-XX:+PrintTLABView the usage of the TLAB space
XX:+PrintTenuringDistributionView the threshold for the new survival period after each minor GC
-eaTurn on assert assert
-XprofPerformance diagnostics
-XrunhprofPerformance diagnostics
-XX:+TraceClassLoadingPrints information about the class loading processSimilar to [Loaded java.util.AbstractList$Itr from /Library/Java/JavaVirtualMachines/jdk1.8.0_111.jdk/Contents/Home/jre/lib/rt.jar]
-XX:+TraceClassUnloadingPrint class uninstall process information
XbootclasspathSpecifies the loading of classes that do not require checksSkipping the necessary pre-load checks can reduce load time, but it is not safe
-XX:+PrintCompilationPrint the method name that Hotspot compiles using JIT
-XX:+HeapDumpOnOutOfMemoryErrorOM when generating a heap dumpThe default output is in the root folder where the class files are stored
-XX:HeapDumpPathSet the output OM dump file pathUse with -XX:+HeapDumpOnOutOfMemoryError

Appendix

[Standard VM Parameter Sheet]

Parameter NamedescriptionDefault
-d32Use a 32-bit data model (if available)
-d64Use a 64-bit data model (if available)
-serverSelect the server VMThe default VM is server because you are running on a server-like machine.
-cp < directory and zip/jar file class search path >
-classpath < the class search path for directories and zip/jar files >Use : a list of separated directories, JAR archives, and ZIP archives to search for class files
-D<名称>=<值>Set system properties
-verbose: [class or gc or jni]Enable detailed output
-versionOutput the product version and exit
-<值>version:Deprecated
-showversionOutput the product version and continue
-jre-restrict-search or -no-jre-restrict-searchDeprecated
-? -helpOutput this help message
-XOutput help with non-standard options
-ea[:< package name, class name>]assert
-enableassertions[:< package name, class name>]Enable assertions at the specified granularity
-da[:< package name, class name>]
-disableassertions[:< package name, class name>]Disable assertions with a specified granularity
-esa or -enablesystemassertionsEnable system assertions
-dsa or -disablesystemassertionsDisable system assertions
-agentlib:<libname>[=<选项>]Load the native agent library <libname>For example, -agentlib:hprofSee also -agentlib:jdwp=help and -agentlib:hprof=help
-agentpath:<pathname>[=<选项>]Load the local agent library by the full pathname
-javaagent:<jarpath>[=<选项>]To load the Java programming language agent, see java.lang.instrument
-splash:<imagepath>Display the splash screen with the specified image






Previous:Nuget Series 1 uses asp.net to build a private Nuget repository
Next:Mysql CURRENT_TIMESTAMP and ON UPDATE CURRENT_TIMESTAMP differentiated
 Landlord| Posted on 2022-1-13 09:50:32 |


Note: -Xms256m -Xmx1536m cannot be placed after the jar parameter!
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com