Set JVM memory and JVM monitoring tuning in Eclipse

Source: Internet
Author: User
Tags garbage collection xms

When we found in the IDE console:


The value of the persistent generation set for the JVM is too small, you need to open the window->preferences->java->installed JRE in Eclispe, click the Edit button on the right, and the default VM Arguments option, increase the value of-xx:permsize and-xx:maxpermsize.


If you understand JVM performance tuning, you can learn about the relationship from Jstat monitoring. The following is the actual demo operation:

1, according to the steps to change the value of-xx:permsize and-xx:maxpermsize to small enough, deliberately build project start error, I set to 32m. Then save.


2. Open the DOS window while launching Tomcat in the IDE and get the process ID using the JPS command (this process ID is the process ID of the Javaw.exe in the Windows Task Manager-process)

3. And immediately perform JVM monitoring:

Now for the analysis:

Found that Pu equals the value of the PC, and also equal to the previous set in the IDE-xx:maxpermsize value (32768/1024=32m), combined with the following terminology can be seen to see that the long-term use of space has reached the maximum value of 32m, so reported " Java.lang.OutOfMemoryError:PermGen space "error.

If you find that the YGC value is particularly large, then set the value of-xmn a bit larger (by-xmn10m option to specify the sum of s0c, S1C, and EC is 10m), pay special attention to FGC, try to make the value of FGC not too large (workaround: Set the value of-XMS and-xmx a bit larger), Because FGC checks for all surviving objects during garbage collection, it takes longer than YGC. So that your application is unresponsive, so you should try to reduce FGC. (All garbage collection is "Stop the World" event because all application threads will stop until the operation is complete)

Some terms are explained in Chinese:
s0c: Capacity of the first Survivor (Survivor area) in the Young Generation (bytes)
s1c: Capacity of the second survivor (Survivor area) in the younger generation (bytes)
s0u: The first survivor (Survivor area) of the young generation has currently used space (bytes)
s1u: The second survivor (Survivor area) of the young generation has currently used space (bytes)
EC: The Capacity of Eden (Eden) in the Young Generation (bytes)
EU: Eden (Eden) in the young generation has currently used space (bytes)
capacity of the Oc:old generation (bytes)
Ou:old currently used space (bytes)
pc:perm (persistent generation) capacity (bytes)
pu:perm (persistent generation) currently used space (bytes)
YGC: Number of GC times in young generations from application startup to sampling
YGCT: The time taken by the GC in the young generation from application startup to sampling (s)
FGC: Old (full GC) GC count from application boot to sampling
FGCT: Time taken from an old (full GC) GC when the application boots to sampling (s)
GCT: GC Total time from Application boot to sample (s)


VM Switch VM Switch Description
-xms Sets the initialization size of the heap when the JVM starts.
-xmx Sets the maximum heap value.
-xmn Set the size of the young generation's space, leaving the space for the old age.
-xx:permgen Sets the initialization size for the permanent generation of memory.
-xx:maxpermgen Sets the maximum value for the permanent generation.
-xx:survivorratio Provides the spatial proportions of the Eden and survivor areas. For example, if the size of the young generation is 10m and the VM switch is-xx:survivorratio=2, then 5m memory will be reserved for the Eden Zone and each survivor area to allocate 2.5m memory. The default scale is 8.
-xx:newratio Provides the proportion of old and young generations. The default value is 2.



Set JVM memory and JVM monitoring tuning in Eclipse

Related Article

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.