Java FAQ _07JVM Architecture (017) _JVM Common configurations

Source: Internet
Author: User

Click to enter _ more _java thousand ask

1. What are the common configuration of the JVM?

Understanding the JVM memory model look here: What is the Java memory model
Understanding JVM Memory Management Look here: How the JVM manages memory
Understanding the JVM garbage collection mechanism look here: What is the Java garbage collection mechanism

There are many JVM configurations, grouped by type, that are often used to optimize JVM memory (see here: How Java memory is optimized), common configuration:

Learn about the garbage collector see here: What are the ways Java garbage collection works

  1. Heap Settings
    -xms=n
    The initial heap size.
    -xmx=n
    The maximum heap size.
    -xmn=n
    Cenozoic size, this configuration takes precedence over-xx:newratio, that is, if-xmn,-xx:newratio is configured to fail.
    -xx:newratio=n
    The ratio of Laosheng generation to Cenozoic, for example, is 3, which means that the ratio of Cenozoic to Laosheng is 1:3.
    -xx:survivorratio=n
    The ratio of the Eden and survivor regions in the Cenozoic. The survivor is differentiated into equivalent two zone s0,s1. For example,-xx:survivorratio=3 represents Eden:s0:s1=3:1:1.
    -xx:maxpermsize=n
    Sets the permanent generation (method area) size.
    -xx:maxgcpausemillis=n
    Sets the maximum garbage collection pause time.
    -xx:gctimeratio=n
    Set a garbage collection time as a percentage of the program run time, and the percentage of time spent on the GC does not exceed 1/(1 + N).

  2. Garbage collector settings
    -xx:+useserialgc
    Sets the serial collector.
    -xx:+useparallelgc
    Sets the parallel collector.
    -xx:+useparalleloldgc
    Sets the parallel old generation collector.
    -xx:+useconcmarksweepgc
    Sets the concurrency collector.
    -xx:+useg1gc
    G1 garbage collector.

  3. Parallel collector settings
    -xx:parallelgcthreads=n
    Set the concurrency collector the number of threads that the young generation collects in parallel collection.

  4. Concurrent collector Settings
    -xx:+cmsincrementalmode
    Set to incremental mode. In incremental mode, the concurrency collector does not monopolize the entire cycle during the concurrency phase, but periodically pauses and wakes up the application thread. The collector divides the concurrency phase work into fragments and arranges for secondary (minor) recycling operations. For servers that require low latency and less CPU. The general single CPU turns on incremental mode.
    -xx:parallelcmsthreads=n
    The number of threads used by the concurrent garbage collector to mark the scan

  5. Garbage collection Statistics
    -xx:+printgc
    Output GC log, summary log.
    -xx:+printgcdetails
    Print GC logs detailing the logs for each zone.
    -xx:+printgctimestamps
    Print GC logs detailing the GC run time logs. The timestamp of the output GC is shown in the form of a base time.
    -xx:+printgcdatestamps
    Print GC logs detailing the GC run time logs. The timestamp of the output GC is displayed as a date.
    -xx:+printheapatgc
    Print out the heap information before and after the GC is printed.
    -XLOGGC:.. /logs/gc.log
    The output path of the log file.

Summarized as follows:

Java FAQ _07JVM Architecture (017) _JVM Common configurations

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.