Flag | What it does | When to use it | See also |
-server | Chooses the server compiler | For long-running applications that need fast performance | |
-client | Chooses the client compiler | For applications where start-up is the most important factor | |
-XX:+TieredCompilation | Utilize tiered compilation (both client and server) | For applications where you want the best possible performance and have enough available native memory for the extra compiled code | |
-XX:ReservedCodeCacheSize=<MB> | Reserves space for code compiled by the JIT compiler | When you see a warning that you are out of code cache, and generally with when using tiered compilation. | |
-XX:InitialCodeCacheSize=<MB> | Allocates the initial space for code compiled by the JIT compiler | If you need to pre-allocate the memory for the code cache, which is very uncommon. | |
-XX:CompileThreshold=<N> | The number of times a method or loop is executed before compiling it. | When using the server compiler, can cause more methods to be compiled, and methods to be compiled sooner. The first case is sometimes an advantage if you aren’t using tiered compilation. | |
-XX:+PrintCompilation | Provide a log of operations by the JIT compiler. | When you suspect an important method isn’t being compiled, or are generally curious as to what the compiler is doing. | |
-XX:+CICompilerCount=<N> | Number of threads used by the JIT compiler. | When using tiered compilation and too many compiler threads are being started (particularly on large machines running multiple JVMs). |
Flag | What it does | When to use it | See also |
-XX:+UseSerialGC | Use a simple, single-threaded GC algorithm. | For small (100MB) heaps | |
-XX:+UseParallelOldGC | Uses multiple threads to collect the old generation while application threads are stopped. | When your application can tolerate occasional long pauses and you want to maximize throughput while minimizing CPU usage. | |
-XX:+UseParallelGC | Uses multiple threads to collect the young generation while application threads are stopped. | Use in conjunction with UseParallelGC. | |
-XX:+UseConcMarkSweepGC | Uses background thread(s) to remove garbage from the old generation with minimal pauses. | When you have available CPU for the background thread, you do not want long GC pauses, and you have a relatively small heap. | |
-XX:+UseParNewGC | Uses multiple threads to collect the young generation while application threads are stopped. | Use in conjunction with UseConcMarkSweepGC. | |
-XX:+UseG1GC | Uses multiple threads to collect the young generation while application threads are stopped, and background thread(s) to remove garbage from the old generation with minimal pauses. | When you have available CPU for the background thread, you do not want long GC pauses, and you do not have a small heap. |
Flag | What it does | When to use it | See also |
-Xms | Sets the initial size of the heap. | When the default initial size is too small for your application. | |
-Xmx | Sets the maximum size of the heap. | When the default maximum size is too small (or possibly too large) for your application. | |
-XX:NewRatio | Sets the ratio of the young generation to the old generation. | Increase this to reduce the proportion of the heap given to the young generation; lower it to increase the proportion of the heap given to the young generation. This is only an initial setting; the proportional will change unless adaptive sizing is turned off (except for CMS, when the young generation size is constant). As the young generation size is reduced, you will see more frequent young GCs and less frequent Full GCs (and vice versa). | |
-XX:NewSize | Sets the initial size of the young generation. | When you have finely-tuned your application requirements. | |
-XX:MaxNewSize | Sets the maximum size of the young generation. | When you have finely-tuned your application requirements. | |
-Xmn | Sets the initial and maximum size of the young generation. | When you have finely-tuned your application requirements. | |
-XX:PermSize=N (JDK 7 only) | Sets the initial size of the permgen. | For applications that use a lot of classes, increase this from the default. | |
-XX:MaxPermSize=N (JDK 7 only) | Sets the maximum size of the permgen. | For applications that use a lot of classes, increase this from the default. | |
-XX:MetaspaceSize=N (JDK 8 only) | Sets the initial size of the metaspace. | For applications that use a lot of classes, increase this from the default. | |
-XX:MaxMetaspaceSize=N (JDK 8 only) | Sets the maximum size of the metaspace. | Lower this number to limit the amount of native space used by class metadata. | |
-XX:ParallelGCThreads=N | Sets the number of threads used by the garbage collectors | Lower this value on systems running many JVMs. Consider increasing it for JVMs with very large heaps on very large systems. | |
-verbose:gc | Enables basic GC logging. | GC logging should always be enabled, but other more detailed logs are generally better. | |
-Xloggc:<path> | Directs the GC log to a special file rather than standard output. | Always, the better to preserve the information in the log. | |
-XX:+PrintGC | Enables basic GC logging. | GC logging should always be enabled, but other more detailed logs are generally better. | |
-XX:+PrintGCDetails | Enables detailed GC logging. | Always, even in production (the logging overhead is minimal). | |
-XX:+PrintGCTimeStamps | Prints a relative time stamp for each entry in the GC log. | Always, unless date stamps are enabled. | |
-XX:+PrintGCDateStamps | Prints a time of day stamp for each entry in the GC log. | Has slightly more overhead than time stamps, but may be easier to process. | |
-XX:+PrintReferenceGC | Prints information about soft and weak reference processing during GC. | If the program uses a lot of those references, add this flag to determine their effect on the GC overhead. | |
-XX:+UseGCLogFileRotation | Enables rotations of the GC log to conserve file space. | In production systems that run for weeks at a time when the GC logs can be expected to consume a lot of space. | |
-XX:NumberOfGCLogFiles=N | When log file rotation is enabled, the number of log files to retain. | In production systems that run for weeks at a time when the GC logs can be expected to consume a lot of space. | |
-XX:GCLogFileSize=N | When log file rotation is enabled, the size of each log file before rotating it. | In production systems that run for weeks at a time when the GC logs can be expected to consume a lot of space. | |
-XX:+UseAdaptiveSizePolicy | When set, the JVM will resize various heap sizes to attempt to meet GC goals. | Turn this off if the heap sizes have been finely tuned | |
-XX:+PrintAdaptiveSizePolicy | Adds information about how generations are resized to the GC log. | Use this flag to gain an understanding of how the JVM is operating. When using G1, check this output to see if full GCs are triggered by humongous object allocation. | |
-XX:+PrintTenuringDistribution | Add tenuring information to the GC logs. | Use the tenuring information to determine if and how the tenuring options should be adjusted. | |
-XX:InitialSurvivorRatio=N | The amount of the young generation set aside for survivor spaces. | Increase this if short-lived objects are being promoted into the old generation too frequently. | |
-XX:MinSurvivorRatio=N | The adaptive amount of the young generation set aside for survivor spaces. | Decreasing this values reduces maximum size of the survivor spaces (and vice versa). | |
-XX:TargetSurvivorRatio=N | The amount of free space the JVM attempts to keep in the survivor spaces. | Increasing this value reduces the size of the survivor spaces (and vice versa). | |
-XX:InitialTenuringThreshold=N | The initial number of GC cycles the JVM attempts to keep an object in the survivor spaces. | Increase this number to keep objects in the survivor spaces longer, though be aware that the JVM will tune it. | |
-XX:MaxTenuringThreshold=N | The maximum number of GC cycles the JVM attempts to keep an object in the survivor spaces. | Increase this number to keep objects in the survivor spaces longer; the JVM will tune the actual threshold between this value and the initial threshold. |
Flag | What it does | When to use it | See also |
-XX:MaxGCPauseMillis=N | Hints to the throughput collector how long pauses should be; the heap is dynamically sized to attempt to meet that goal. | As a first step in tuning the throughput collector if the default sizing it calculates doesn’t meet application goals. | |
-XX:GCTimeRatio=N | Hints to the throughput collector how much time you are willing to spend in GC; the heap is dynamically sized to attempt to meet that goal. | As a first step in tuning the throughput collector if the default sizing it calculates doesn’t meet application goals. | |
-XX:-AggressiveHeap | Enables a set of tuning flags that are “optimized” for machines with a large amount of memory running a single JVM with a large heap. | It is better not to use this flag, and instead use specific flags as necessary. |
Flag | What it does | When to use it | See also |
-XX:CMSInitiatingOccupancyFraction=N | The point at which CMS should begin background scanning of the old generation. | When CMS experiences concurrent mode failures, reduces this value. | |
-XX:+UseCMSInitiatingOccupancyOnly | Use only the CMSInitiatingOccupancyFraction to determine when to start CMS background scanning. | Whenever CMSInitiatingOccupancyFraction is specified. | |
-XX:ConcGCThreads=N | Sets the number of threads to use for CMS background scanning. | When lots of CPU is available and CMS is experiencing concurrent mode failures. | |
-XX:+CMSPermGenSweepingEnabled | Directs CMS to sweep the permgen. | When using CMS with an application server that performs lots of class unloading. | |
-XX:CMSInitiatingPermOccupancyFraction=N | Point at which CMS should scan permgen | When CMSPermGenSweepingEnabled is set and full GCs occur because CMS didn’t clean up permgen fast enough. | |
-XX:+CMSClassUnloadingEnabled | Direct CMS to unload classes after the permgen is scanned. | Whenever CMSPermGenSweepingEnabled is set. | |
-XX:+CMSIncrementalMode | Run CMS in incremental mode. | If CPU is limited and you still must run CMS. | |
-XX:CMSIncrementalModeSafetyFactor=N | Affects how often incremental CMS background threads run. | When using incremental CMS and experiencing concurrent mode failures, increase this value. | |
-XX:CMSIncrementalDutyCycleMin=N | Affects how often incremental CMS background threads run. | When using incremental CMS and experiencing concurrent mode failures, increase this value, though setting CMSIncrementalModeSafetyFactor is preferred. | |
-XX:CMSIncrementalDutyCycleMax=N | Affects how often incremental CMS background threads run. | When using incremental CMS and experiencing concurrent mode failures, increase this value, though setting CMSIncrementalModeSafetyFactor is preferred. | |
-XX:+CMSIncrementalDutyCycle | Affects how often incremental CMS background threads run. | When using CMSIncrementalDutyCycleMin, set this flag. |
Flag | What it does | When to use it | See also |
-XX:MaxGCPauseMillis=N | Hints to the G1 collector how long pauses should be; the G1 algorithm is adjusted to attempt to meet that goal. | As a first step in tuning the G1 collector; increase this value to attempt to prevent full GCs. | |
-XX:ConcGCThreads=N | Sets the number of threads to use for G1 background scanning. | When lots of CPU is available and G1 is experiencing concurrent mode failures. | |
-XX:InitiatingHeapOccupancyPercent=N | The point at which G1 background scanning begins. | Lower this value if G1 is experiencing concurrent mode failures. | |
-XX:G1MixedGCCountTarget=N | The number of mixed GCs over which G1 attempts to free the garbage old generation regions. | Lower this value if G1 is experiencing concurrent mode failures; increase it if mixed GC cycles take too long. | |
-XX:G1HeapRegionSize=N | The size of a G1 region. | Increase this value for very large heaps, or when the application allocated very, very large objects. |
Flag | What it does | When to use it | See also |
-XX:+HeapDumpOnOutOfMemoryError | Generate a heap dump when the JVM throws an out of memory error | Enable this flag if the application throws out of memory errors due to the heap space or permgen so the heap can be analyzed for memory leaks. | |
-XX:+HeapDumpPath | Specify the filename where automatic heap dumps should be written. | To specify a path other than java_pid<pid>.hprof for heap dumps generated on out of memory errors or GC events (when those options have been enabled). | |
-XX:SoftRefLRUPolicyMSPerMB=N | Controls how long soft references survive after being used. | Decrease this value to clean up soft references more quickly, particularly in low-memory conditions. | |
-XX:MaxDirectMemorySize=N | Controls how much native memory can be allocated via the | Consider setting this if you want to limit the amount of direct memory a program can allocate. Note that it is not longer necessary to set this flag to allocate more than 64MB of direct memory. | |
-XX:+UseLargePages | Directs the JVM to allocate pages from the operating system’s large page system, if applicable. | If supported by the OS, this option will generally improve performance. | |
-XX:+LargePageSizeInBytes=N | Directs the JVM to allocate large pages of the given size (Solaris only). | On large Solaris systems, increase this value (to, say, 256M) for best performance. | |
-XX:+StringTableSize=N | Sets the size of the hashtable the JVM uses to hold interned strings. | Increase this value if the application performs a significant amount of string interning. | |
-XX:+UseCompressedOops | Emulate 35-bit pointers for object references. | This is the default for heaps that are less than 32GB in size; there is never an advantage to disabling it. | |
-XX:+PrintTLAB | Print summary information about TLABs in the GC log. | When using a JVM without support for JFR, use this to ensure that TLAB allocation is working efficiently. | |
-XX:TLABSize=N | Sets the size of the TLABs. | When the application is performing a lot of allocation outside of TLABs, use this value to increase the TLAB size. | |
-XX:-ResizeTLAB | Disable resizing of TLABs. | Whenever TLABSize is specified, make sure to disable this flag. |
Flag | What it does | When to use it | See also |
-Xss<N> | Sets ths size of the native stack for threads. | Particularly on 32-bit JVMs, decrease this size to make more memory available for other parts of the JVM. | |
-XX:-BiasedLocking | Disables the biased locking algorithm of the JVM. | Often helps performance of thread-pool based applications. |
Flag | What it does | When to use it | See also |
-XX:+AlwaysLockClassLoader | Revert the Java 7 parallel classloading scheme to the Java 6 non-parallel scheme. | On large systems loading classes in only a single thread, startup performance may slightly benefit by using this flag. | |
-XX:-StackTraceInThrowable | Prevents the stack trace from being gathered whenever an exception is thrown. | On systems with very deep stacks where exceptions are frequently thrown (and where fixing the code to throw fewer exceptions is not a possibility). | |
-XX:-RestrictContended | Allows non-JDK code to use the | Set this if application code uses the | |
-XX:-EnableContended | Disables JDK code from using the | This should likely be left enabled. Disabling may save a small amount of space in certain JDK classes. | |
-XX:+AggressiveOpts | Enables certain optimizations for the JVM. These optimizations are likely to become defaults in future releases. | You can test with this flag to determine if it helps, but be aware that it may not work the same when JVM versions change. |
Flag | What it does | When to use it | See also |
-XX:+FlightRecorder | Enable Java Flight Recorder. | Enabling Flight Recorder is always recommended, as it has very little overhead unless an actual recording is happening (in which case, the overhead will vary depending on the features used, but still be relatively small). | |
-XX:+FlightRecorderOptions | Options to set up a default recording via the command line. | Control how a default recording can be made for the JVM. | |
-XX:+UnlockCommercialFeatures | Allows the JVM to use commercial (non open-source) features. | If you have the appropriate license, setting this flag is required to enable Java Flight Recorder. |
18.191.192.59