问题描述:

  What is Verbose Garbage Collection (verbosegc) and How do I Enable it on WebLogic

问题分析:

  通过添加gc参数解决

解决办法:

Verbose garbage collection (verbosegc) is a Java option you can set, when starting WebLogic, so that all java garbage collection activity is recorded to a WebLogic log. Verbose garbage collection is sometimes enabled for diagnostic purposes, when there are memory-related issues or performance-related issues on the WebLogic server. Although there are many options for java tuning, our developers often request verbosegc to troubleshoot memory issues.

HOW TO ENABLE VERBOSE GARBAGE COLLECTION

To enable verbose garbage collection, do the following:

1. First add the 'Verbose Garbage Collection' option to the java command line. Below are instructions, based on the operating system you are using:

In Linux environments (using PeopleTools 8.53 - 8.57 PeopleTools releases):
a. Edit <PIA_HOME>/webserv/<DOMAIN_NAME>/bin/setEnv.sh
b. Add parameter '-verbose:gc and -XX:+PrintGCDateStamps' to the "JAVA_OPTIONS_LINUX" line .  Example
JAVA_OPTIONS_LINUX="-Xms2048m  -Xmx2048m -verbose:gc -XX:+PrintGCDateStamps -Dtoplink....

In Solaris environments (using PeopleTools 8.56 or lower PeopleTools release):
a. Edit <PS_HOME>/webserv/<DOMAIN_NAME>/bin/setEnv.sh
b. Add parameters ' -XX:+PrintGCDateStamps -verbosegc' to the "JAVA_OPTIONS_OS" line .
For example:
   JAVA_OPTIONS_SOLARIS="-server -Xms2048m -Xmx2048m -XX:MaxpermSize=128m  -XX:+PrintGCDateStamps -verbosegc -Dtoplink....

In HP and AIX enviroments:
a. Edit <PS_HOME>/webserv/<DOMAIN_NAME>/bin/setEnv.sh
b. Add parameter '-verbose:gc -XX:+PrintGCTimeStamps' to the "JAVA_OPTIONS_OS" line .
For example, if web server is on AIX, the following change would be made:
   JAVA_OPTIONS_AIX="-server -Xms512m -Xmx512m -verbose:gc -XX:+PrintGCTimeStamps -Dtoplink....
For HP:
   JAVA_OPTIONS_HPUX="-server -Xms2048m -Xmx2048m -verbose:gc -XX:+PrintGCTimeStamps -Dtoplink....

In Windows environment where WebLogic is started as a Windows service, update the Windows registry as follows:
a. Choose start-run-regedit
b. From regedit, go to [HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\peoplesoft-PIA, or whatever your service name is.
c. Highlight that service and expand
d. Click 'Parameters'
e. Double-click on cmdline.
f.  If Using JRockit (ie PeopleTools 8.50 to 8.52), then add '-Xverbose:gc -Xverbosetimestamp' after the heap settings.
    Example:
        -server -Xms2048m -Xmx2048m -Xverbose:gc -Xverbosetimestamp ......
    If Using Sun Java (PeopleTools 8.49 or older and 8.53 and higher), then add '-verbosegc' after parameter MaxPermSize.
    Example:
        -server -Xms256m -Xmx2048m -XX:MaxPermSize=2048m -verbosegc ......

In Windows environment, where WebLogic is started in foreground, add the verbose gc parameters (outlined above)  to line JAVA_OPTIONS_WINxx in setEnv.cmd.

NOTE: You can redirect the Garbage Collection output to a separate file by using the parameter -Xloggc. For example on Windows add -Xloggc:c:\temp\gc.log

2. Restart the web server in order to pick up the change

3. The verbose garbage collection will be logged to the following file: 
a. If using Linux, file is <PS_CFG>/webserv/<DOMAIN_NAME>/servers/PIA/logs/PIA_stderr.log 
b. If using Windows service, file is   <PS_CFG>/webserv/<DOMAIN_NAME>/servers/PIA/NTservice-<DOMAIN-NAME>-PIA.log
c. If using IBM, file is <PS_CFG>/webserv/<DOMAIN_NAME>/servers/PIA/PIA_stderr.log
d. For all other platforms, the verbose garbage collection is usually logged to <PS_CFG>/webserv/<DOMAIN_NAME>/servers/PIA/logs/PIA_stdout.log

HOW TO ANALYZE VERBOSE GARBAGE COLLECTION LOGS
======================================================
When analyzing verbose garbage collection we often concentrate on the full garbage collections (vs minor collections). Points of interest are:
    a) How often is full garbage collection taking place?
    b) How long is garbage collection taking? Full garbage collection should not take longer than 3 to 5 seconds.
    c) What is your average memory footprint? In other words, what does the heap settle back down to after each full garbage collection?

Note that depending on the type and version of Java you are using (JRockit, IBM, HP or Sun), the format for a full GC varies.   Below are a couple examples:

EXAMPLE 1:
-----------------
Below is an example of a log entry, for a full GC in a WebLogic environment using JRockit R28:

46.587-46.829: OC 505693KB->395689KB (4194304KB), 0.243 s, sum of pauses 204.262 ms, longest pause 204.262 ms.

The format, for the above example is:

<start>-<end>: <type> <before>KB-><after>KB (<heap>KB), <time> ms, sum of pauses <pause> ms

In the above example, the type 'OC' stands for 'Old Collection', which is the same as a full Garbage collection ('YC' or 'Young Collection' is the type used for a minor GC). In this example, heap usage before GC was 505.7 meg. After the GC, the heap usage was 395.7 meg.   The heap is set to a max of 4 gb.  It took 204 milliseconds to perform the garbage collection.

EXAMPLE 2:
-----------------
Below is an example of a log entry, for a full GC in a WebLogic environment using Sun Java:

[Full GC 28053K->28022K(255104K), 0.3735740 secs][Mon Nov 24 11:42:56 2008]

The format is

[GC<before>K-><after>K(<heap>K)<total>secs]

In above example, usage before GC was 28053K and 28022K after the GC. The heap size is set to 255104K. It took .37 seconds for the GC.

EXAMPLE 3:
--------------------
For IBM, the verbose GC information is normally in xml format.  Example:

<af type="tenured" id="1" timestamp="Aug 13 16:19:36 2013" intervalms="0.000">
  <minimum requested_bytes="272" />
  <time exclusiveaccessms="0.916" meanexclusiveaccessms="0.470" threads="2" lastthreadtid="0x0000000031C39700" />
  <refs soft="12698" weak="8843" phantom="32" dynamicSoftReferenceThreshold="29" maxSoftReferenceThreshold="32" />
  <tenured freebytes="53686272" totalbytes="1073741824" percent="4" >
    <soa freebytes="0" totalbytes="1020055552" percent="0" />
    <loa freebytes="53686272" totalbytes="53686272" percent="100" />
  </tenured>
  <gc type="global" id="2" totalid="2" intervalms="65208.114">
    <classunloading classloaders="48" classes="0" timevmquiescems="0.000" timetakenms="7.874" />
    <finalization objectsqueued="9836" />
    <timesms mark="188.929" sweep="8.768" compact="0.000" total="206.155" />
    <tenured freebytes="920823288" totalbytes="1073741824" percent="85" >
      <soa freebytes="867137016" totalbytes="1020055552" percent="85" />
      <loa freebytes="53686272" totalbytes="53686272" percent="100" />
    </tenured>
  </gc>

Note that the attributes of most interest are the "tenured freebytes" (after the "af" section and after the "gc" section) as this shows you heap size before and after the garbage collection.

What is Verbose Garbage Collection (verbosegc) and How do I Enable it on WebLogic的更多相关文章

  1. [翻译]Java垃圾收集精粹(Java Garbage Collection Distilled)

    source URL: http://www.infoq.com/articles/Java_Garbage_Collection_Distilled Name: Java Garbage Colle ...

  2. Advanced .NET Debugging: Managed Heap and Garbage Collection(转载,托管堆查内存碎片问题解决思路)

    原文地址:http://www.informit.com/articles/article.aspx?p=1409801&seqNum=4 Debugging Managed Heap Fra ...

  3. Garbage Collection Optimization for High-Throughput and Low-Latency Java Applications--转载

    原文地址:https://engineering.linkedin.com/garbage-collection/garbage-collection-optimization-high-throug ...

  4. Unity性能优化(3)-官方教程Optimizing garbage collection in Unity games翻译

    本文是Unity官方教程,性能优化系列的第三篇<Optimizing garbage collection in Unity games>的翻译. 相关文章: Unity性能优化(1)-官 ...

  5. How Garbage Collection Really Works

    Java Memory Management, with its built-in garbage collection, is one of the language's finest achiev ...

  6. Java Garbage Collection Basics--转载

    原文地址:http://www.oracle.com/webfolder/technetwork/tutorials/obe/java/gc01/index.html Overview Purpose ...

  7. AutoReleasePool 和 ARC 以及Garbage Collection

    AutoReleasePool autoreleasepool并不是总是被auto 创建,然后自动维护应用创建的对象. 自动创建的情况如下: 1. 使用NSThread的detachNewThread ...

  8. The Impact of Garbage Collection on Application Performance

    As we’ve seen, the performance of the garbage collector is not determined by the number of dead obje ...

  9. [Java] 垃圾回收 ( Garbage Collection ) 的步骤演示

    关于 JVM 垃圾回收机制的基础内容,可参考上一篇博客 垃圾回收机制 ( Garbage Collection ) 简介 上一篇博客,介绍了堆的内存被分为三个部分:年轻代.老年代.永生代.这篇博文将演 ...

随机推荐

  1. Python3基础 global 在函数内部对全局变量进行修改

             Python : 3.7.3          OS : Ubuntu 18.04.2 LTS         IDE : pycharm-community-2019.1.3    ...

  2. C2678 二进制“>>”: 没有找到接受“std::stringstream”类型的左操作数的运算符(或没有可接受的转换)

    C2678 二进制“>>”: 没有找到接受“std::stringstream”类型的左操作数的运算符(或没有可接受的转换)

  3. 一起玩"Docker"之1——Ubuntu配置安装Docker运行环境并安装(Ubuntu、Centos)镜像

    Docker 是一个开源的应用容器引擎,基于 Go 语言 并遵从Apache2.0协议开源. Docker 可以让开发者打包他们的应用以及依赖包到一个轻量级.可移植的容器中,然后发布到任何流行的 Li ...

  4. 123457123456#0#----com.ppGame.HappyShuXue54--前拼后广--儿童数学_pp

    com.ppGame.HappyShuXue54--前拼后广--儿童数学_pp

  5. 【分布式一致性】etcd

    etcd: https://jimmysong.io/kubernetes-handbook/concepts/etcd.html 什么是 分布式一致性: http://thesecretliveso ...

  6. Traking-Learning-Detection TLD经典论文部分翻译

    摘要 本文研究视频流中未知目标的长期跟踪问题.在第一帧,通过选定位置和大小定义跟踪目标.在接下来的每一帧中,跟踪任务是确定目标的位置和大小或者说明目标不存在.我们提出了一种新颖的跟踪框架(TLD),明 ...

  7. JIRA中的并联审批流程定制

    JIRA号称可以跟踪任何事务,让JIRA的流程来匹配团队的工作流程,而不是让你的团队适应JIRA的工作流程.但是在实践中,有些有些流程用JIRA还是比较困难的,比如并联审批流程,一个并联审批流程需求大 ...

  8. CentOS7.6安装Pycharm并添加快捷方式

    1.以用户身份登录jiangshan 并建立/home/jiangshan/pycharm文件夹2.下载 pycharm-community-anaconda-2019.1.3.tar.gz 放置在/ ...

  9. [WCF] - 使用 bat 批处理文件将 WCF 服务部署为 Windows Service

    1. 添加 Windows Service 项目 2. 添加 WCF 项目引用 3. 更新 App.config 配置文件(可以从 WCF的 Web.config 拷贝过来),设置服务地址. 4. 配 ...

  10. (6)Spring Boot web开发 --- 错误处理页面

    文章目录 处理时间(`Date`)类型 thymeleaf 页面拼接字符串 映射路径占位符 使用 put.delete 方法 错误处理机制 处理时间(Date)类型 Spring Boot 进行参数绑 ...