Tuning Policy for JVM tuning

Source: Internet
Author: User
tuning needs to focus on several aspects of memory tuning CPU using tuning lock competitive tuning I/O Tuning Fundamentals:
The number of objects to be transferred to the old age is minimized. Reduce the execution time of full GC. The goal is to minor GC time within 100MS and full gc time within 1s. Main tuning Parameters:

Set the heap memory size, which is the most basic. -XMS: Heap memory space When the JVM is started. -XMX: Maximum heap memory limit.

Sets the Cenozoic size.

The new generation should not be too small, otherwise there will be a large number of objects pouring into the old age. -xx:newratio: The proportion of the new generation and the old age. -xx:newsize: Cenozoic space. -xx:survivorratio: The proportion of Eden space and survivor space. -xx:maxtenuringthreshold: Age threshold for objects entering the old age.

Setting up the garbage collector

Young generation:-XX:+USEPARNEWGC.

Old age:-XX:+USECONCMARKSWEEPGC.

CMS can minimize STW time, but does not compress memory, there is a possibility of "parallel mode failure". For example, the old age space has 300MB space, but some 10MB objects cannot be stored sequentially. Compression processing is triggered, but the compression processing time in CMS GC mode is much longer than the parallel GC.

G1 uses the "mark-and-organize" algorithm to solve the memory fragmentation problem and establish a predictable pause-time type, which allows the user to specify a time period of M milliseconds to consume less than n milliseconds for garbage collection.

Memory usage Tuning

OutOfMemoryError exception Reason: May be true data volume is too large, may want to display too much data, possible memory leaks

Data volume is too large to observe and solve: Look at the GC log, see memory changes before and after full GC, changes do not indicate that the amount of data is too large to try to increase the JVM's memory usage consider whether the data really needs to be in memory. can be considered using: LRU algorithm swap out and so on, weak references (Soft References)

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.