Java Performance Optimization-WebSphere GC Log Analysis

Source: Internet
Author: User

The first two articles talked about the tuning policies of the ibm jdk and Sun's hot spot JDK. The important thing that has always been mentioned isYou need to adjust the parameter settings based on GC detailed logs.So how can we analyze the collected logs and adjust the parameters according to the logs? This is what this article describes.

To use the Windows platform and AIX platform of ibm jdk, you only need to check "Detailed garbage collection" in the Java Process attribute of the WebSphere management console, the following information will be generated in native_stdout.log.

This figure shows the main focus of GC logs: the reason for garbage collection, the interval between garbage collection, the remaining space before and after garbage collection, and the duration of garbage collection ......

"Nursery" indicates that the allocation failed (Allocation failure) occurred in the new generation ({
Pagetracker. _ trackpageview ('/outbound/article/publib.boulder.ibm.com ');
} "Href =" http://publib.boulder.ibm.com/infocenter/javasdk/v5r0/index.jsp? Topic =/com.ibm.java.doc. diagnostics.50/diag/tools/gcpd_verbosegc_alloc_new.html "target =" _ blank "> Nursery), which is 44th times (ID = 44) garbage collection is performed because of the allocation failure of the New Generation (since GC logs are enabled). The interval from the last GC occurrence is 12746 ms, and the unallocated space is 8216 bytes, before the garbage collection, the available space for the new generation was 1776 bytes, less than 8216 bytes. Although the remaining space in the old zone was 45%, however, the new memory space cannot be allocated directly in the old area of the year, leading to a cleaning process ({
Pagetracker. _ trackpageview ('/outbound/article/publib.boulder.ibm.com ');
} "Href =" http://publib.boulder.ibm.com/infocenter/javasdk/v5r0/index.jsp? Topic =/com.ibm.java.doc. diagnostics.50/diag/tools/gcpd_verbosegc_scavenger.html "target =" _ blank "> scavenger ).

GC type indicates that this garbage collection is a cleaning process and also a 44th scavenger process. At the same time, it is exactly 44th GC processes, indicating that no such process has occurred {
Pagetracker. _ trackpageview ('/outbound/article/publib.boulder.ibm.com ');
} "Href =" http://publib.boulder.ibm.com/infocenter/javasdk/v5r0/index.jsp? Topic =/com.ibm.java.doc. diagnostics.50/diag/tools/gcpd_verbosegc_global.html "target =" _ blank "> <GC type =" Global "> garbage collection process. Flipped objectcount indicates that 4523143 surviving objects will be copied to the surviving zone (same vor space), while 73768 objects will be copied to the surviving zone multiple times, it is transferred to the tenured space ). We can see that scavenger tiltratio is 89% instead of half-open. It means that after many replication cleanups, JVM has realized that only a few objects can survive each time, as a result, it automatically increases the size of the Eden area in the young generation so that more memory is available for new objects.

The next step is relatively simple. After garbage collection, the remaining space of the new generation is 89%, because allocation failure occurs in the new generation, and fast minor GC is performed, therefore, the available space in the permanent zone is still 45%, and the recovery time is 384.469 Ms. Major GC occurs in the persistent zone. The recovery time is generally longer than minor GC. Therefore, minor GC: minor GC = in a healthy JVM environment (do not worry too much ).

During the time (time exclusiveaccessms) at the beginning of the garbage collection preparation and the process of garbage collection, another thread found that the memory could not be allocated, so it also required a GC process, at this time, a GC queue is generated (<warning details = "exclusive access time limits des previous garbage Collections"/> is displayed ). Generally, the previous garbage collection will release enough space for the two distributions, so the second GC process will be terminated. Of course, if the allocation is insufficient, garbage collection will be performed immediately. However, it is estimated that full GC is required in this case.

The GC type of full GC is global, which is the most time-consuming way to stop the world. Therefore, you need to adjust the parameters as much as possible to avoid this. If it is found that the Sys tag is not caused by AF, but is written at the beginning, it is necessary to ask whether system. GC () is necessary for development? Yes-XdisableexplicitgcTo prohibit (under JDK such as Sun-XX: + disableexplicitgc).

All of the above are the garbage collection logs under ibm jdk. JDK in Sun and HP is similar, but you need to use-XX: printheapatgc: Parameter to print detailed stack information before and after GC. In addition, I suggest adding-Xloggc: FilenameOr-xverbosegclog: file_name (easy to use tools for analysis) is output to a specific file, because sometimes it is output to native_stderr.log or mixed with thread dump in native_stdout.log, which is inconvenient for analysis.

{Heap before GC invocations = 116:
Heap
Def New Generation total 157376 K, used 139904 K [63400000, 6dec0000, 78950000)
Eden space 139904 K, 100% used [63400000, 6bca0000, 6bca0000)
From space 17472 K, 0% used [6bca0000, 6bca0000, 6cdb0000)
To space 17472 K, 0% used [6cdb0000, 6cdb0000, 6dec0000)
Tenured generation total 349568 K, used 79067 K [38800000, 4dd60000, 632b0000)
The space 349568 K, 22% used [38800000, 3d536ce0, 3d536e00, 4dd60000)
Compacting perm Gen total 132096 K, used 132023 K [28800000,309, 38800000)
The space 132096 K, 99% used [28800000,308 edf50, 308ee000, 30900000)
[GC 218971 K-> 83116 K (506944 K), 0.0976948 secs]
Heap after GC invocations = 117:
Heap
Def New Generation total 157376 K, used 4049 K [63400000, 6dec0000, 78950000)
Eden space 139904 K, 0% used [63400000,634, 6bca0000)
From space 17472 K, 23% used [6cdb0000, 6d1a4628, 6dec0000)
To space 17472 K, 0% used [6bca0000, 6bca0000, 6cdb0000)
Tenured generation total 349568 K, used 79067 K [38800000, 4dd60000, 632b0000)
The space 349568 K, 22% used [38800000, 3d536ce0, 3d536e00, 4dd60000)
Compacting perm Gen total 132096 K, used 132023 K [28800000,309, 38800000)
The space 132096 K, 99% used [28800000,308 edf50, 308ee000, 30900000)
}

This is an example of hpjdk output. It is basically no different from ibm jdk. You can add-XX: + printgctimestampsDisplay the interval of each recycle.

 

 

Note:

This article Reprinted from: http://www.hashei.me/2009/06/analyse-the-gc-logs.html

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.