转载 http://hi.baidu.com/nutchen/blog/item/e942a7016dd2c6071c9583d3.html
项目中碰到的情况,居然产生了20多G,把硬盘占满、服务Down掉。原因可能:出现过多内存泄漏,或者分配过多大内存等。解决方法:
1、进入was管理控制台,选择 应用程序服务器 > server1 > 进程定义 > Java 虚拟机,将"最大堆大小"改为768或1024以上(跟机器内存相关,你的机器最好有较大内存)。保存。
2、优化你的程序,减少要求分配较大内存的设计,优化数据连接池。
3、给was打补丁。ibm网站上有相关补丁下载,不过最好升级到同系列的最新版本
4、修改启动文件,使之不产生这些文件,设置如下:
export IBM_HEAP_DUMP=false
export IBM_HEAPDUMP=false
export IBM_HEAPDUMP_OUTOFMEMORY=false
export IBM_JAVACORE_OUTOFMEMORY=false
分析以上4中方法,只有方法2才是根本解决之道。
针对4,IBM网站上有详细阐述,特附如下:
Out of Memory (Java heap) specific MustGather information
Set up for enabling heap dump file generation:
- For releases of V6.0:
- To set the Environment Entries from the administrative console, select the following:
Servers > Application Servers > server_name > Java and Process Management > Process Definition > Environment Entries > New
- Add the following Name and Value pairs:
IBM_HEAPDUMP |
true |
IBM_HEAP_DUMP |
true |
IBM_HEAPDUMPDIR |
your_directory |
IBM_HEAPDUMP_OUTOFMEMORY |
true |
IBM_JAVADUMP_OUTOFMEMORY |
true |
IBM_JAVA_HEAPDUMP_TEXT |
true |
个人建议:在生产环境当中,当应用发生oom 或者 ha 情况下都设置成true,正常情况下设置成false
3. Make sure that you save changes to the master configuration.
- For release V5.1.1:
- To set the Environment Entries from the administrative console, select the following:
Servers > Application Servers > server_name > Process Definition > Environment Entries > New
- Add the following Name and Value pairs:
IBM_HEAPDUMP |
true |
IBM_HEAP_DUMP |
true |
IBM_HEAPDUMPDIR |
your_directory |
IBM_HEAPDUMP_OUTOFMEMORY |
true |
IBM_JAVADUMP_OUTOFMEMORY |
true |
IBM_JAVA_HEAPDUMP_TEXT |
true |
|
|
- Make sure that you save changes to the master configuration.
For releases of V5.0 and V5.1.0:
- To set the Environment Entries from the administrative console, select the following:
Servers > Application Servers > server_name > Process Definition > Environment Entries > New
- Add the following Name and Value pairs:
IBM_HEAPDUMP |
true |
IBM_HEAP_DUMP |
true |
IBM_HEAPDUMPDIR |
your_directory |
IBM_HEAPDUMP_OUTOFMEMORY |
true |
IBM_JAVADUMP_OUTOFMEMORY |
true |
|
|
- Make sure that you save changes to the master configuration.
- For releases of V4.0:
- To enable the heap dump, add the following lines to the top of the adminserver.bat file in the install_root/bin directory, after the call to setupCmdLine.bat:
call "%~dp0setupCmdLine.bat" set IBM_HEAPDUMP=true set IBM_HEAP_DUMP=true set IBM_HEAPDUMP_OUTOFMEMORY=true set IBM_JAVADUMP_OUTOFMEMORY=true set IBM_HEAPDUMPDIR=directory_path |
|
- When you start the administrative server, use the modified adminserver.bat file from a command prompt instead of using the Services panel.
- Notes:
- The heap dump is written to the current directory, install_root/bin, or the directory specified by the IBM_HEAPDUMPDIR environment variable.
- The file that is generated is called heapdumppid.time in internal format txt. This file can be very large; allow for at least the maximum heap size. If the maximum heap is set to 512 MB, allow for .5 GB for the dump.
- Any version of WebSphere Application Server that is using the IBM JDK 1.3.1 SR5 or higher, and 1.4.X, will automatically generate heapdump and javacore files on an OutOfMemory condition. Adding the additional parameters will give you the option to manually generate heapdumps and also specify the directory in which to write the heapdump files. To manually generate heapdumps you will need to issue the WSADMIN command to generate javacore*.txt file. This will also produce a heapdump*.txt file.
When failure occurs:
- This mechanism uses the same signal handler as javacore processing, so do not have DISABLE_JAVADUMP set as an environment variable.
- Follow instructions on enabling verbosegc in WebSphere Application Server.
- Delete all Application Server and FFDC log files, if possible. Back them up, if needed.
- Restart the Application Server.
- Wait for the OutOfMemoryError condition to occur. This should cause the generation of a heapdump.
- If you want to analyze the heapdump yourself, follow instructions to use IBM HeapAnalyzer tool for analyzing JVM heap usage. If you do not want to analyze this yourself, proceed to step 8.
- Collect the following files:
- For releases of V6.0:
- The server.xml file located in the following directory:
install_root\profiles\profile_name\config\cells\ cell_name\nodes\node_name\servers\server_name |
|
- Everything in the following directory:
install_root\profiles\profile_name\logs\server_name |
Specifically, the following logs are needed:
- systemErr
- systemOut
- native_stderr
- native_stdout
- heapdump*.txt or heapdump*.phd
- javacore*.txt
|
- Everything in the following directory:
install_root\profiles\profile_name\logs\ffdc |
|
- All documents requested For all releases below.
- For releases of V5.0 and V5.1:
- The server.xml file located in the following directory:
install_root\config\cells\nodes\node_name\servers\server_name |
Specifically, the following logs are needed:
- systemErr
- systemOut
- native_stderr
- native_stdout
- heapdump*.txt or heapdump*.phd
- javacore*.txt
|
- Everything from the following directory:
install_root\logs\server_name |
|
- Everything from the following directory:
- All documents requested For all releases below.
- For releases of V4.0 and V3.5:
- A XMLConfig full export.
- Everything from the following directory:
install_root\logs |
Specifically, the following log files are needed:
- stderr
- stdout
- tracefile
- heapdump*.txt
- javacore*.txt
|
- All documents requested For all releases below.
- For all releases
- All javacore*.txt files that were created when OutOfMemory conditions occurred. If javacore*.txt files were created, you can find them in the install_root, install_root\bin or in the configured working directory.
- Include the Application Server systemErr, systemOut, native_stderr, and native_stdout logs, if they are located in a different directory.
- List of all other software and version information on the system. For example, any databases, WebSphere MQ, and so forth.
- Follow instructions to send diagnostic information to IBM support.
分享到:
相关推荐
本篇文章将详细讲解如何使用`javacore`和`heapdump`分析工具,特别是针对Websphere环境的`ha`和`jca`工具,以及如何使用JDK1.6来打开和解析这些文件。 首先,`javacore`文件是Java虚拟机(JVM)在遇到特定事件(如...
javacore 文件和 heapdump 文件是 Java 应用程序在遇到致命问题时产生的两个文件,这两个文件可以帮助我们分析和解决 Java 应用程序中的问题。 javacore 文件是一个文本文件,主要保存的是 Java 应用程序各线程在某...
5. **分析文件**:生成的javacore和heapdump文件可以用专门的分析工具打开,如IBM Heap Analysis Tool (HAT),Eclipse Memory Analyzer (MAT)等,它们能提供可视化的分析结果,帮助找出问题。 6. **注意问题**:在...
#### Heapdump与JavaCore的定义 - **Heapdump**:是一个在Java堆空间的快照,包含了所有Java对象的状态和引用关系。它用于分析内存泄漏、过度内存消耗等问题。 - **JavaCore**:是一个Java虚拟机(JVM)在某个时间点...
总结来说,面对Java IBM WebSphere的内存溢出问题,我们需要结合`javacore`和`deapdump`等诊断工具,通过分析脚本和相关库文件,理解内存管理原理,调整JVM配置,并优化代码,才能有效地排查和解决问题。
它能够帮助我们查看javacore文件中的线程状态,分析哪些线程可能阻塞了其他线程,或者消耗了大量的CPU资源。线程的状态包括运行、等待、阻塞、新生、可运行等,不同的状态反映了线程的不同活动情况。 使用"Thread...
此外,`javacore`和`heapdump`工具也是常用的WebSphere dump分析助手,它们提供了关于JVM内存和线程状态的详细信息。 对于z/OS这样的大型主机操作系统,IBM提供了Tivoli OMEGAMON工具集,其中的OMEGAMON XE for ...
《Websphere日常监控手册》不仅提供了一套完整的监控与维护策略,还深入讲解了在特定环境下如何通过配置环境变量来强制生成HEAPDUMP和JAVACORE文件,这对于深入分析WebSphere应用服务器的性能问题具有重要意义。...
- **javacore文件**:记录CPU使用情况,heapdump文件则记录内存状态。 - **自定义解决方案**:针对具体问题如并发读取、日志输出、SQL优化、异常处理等进行定制化改进。 通过上述步骤,可以有效地监控和分析...
在实践中,通过分析JavaCore和HeapDump文件,可以发现和解决内存问题。养成良好的编程习惯,如及时释放不再需要的对象引用,以及合理使用内存池,都能有效改善应用程序的性能。 总结来说,Java性能调优中的垃圾回收...
在IBM WebSphere上,启用“自动堆转储”后,当内存溢出发生时,会在特定目录下生成`javacore*`和`heapdump*`文件,这些文件包含CPU线程和内存使用情况的详细信息,可用于分析问题。 4. **内存溢出原因**: - **...
同时,在应用程序目录下发现了由WAS自动生成的`heapdump.phd`文件和`javacore`文件,初步判断是由于内存溢出导致的问题。 - **OutOfMemoryError**:在WAS日志中找到了“OutOfMemoryError”关键字,确认了内存溢出的...
这包括但不限于系统日志、交易日志和Heap Dump及JavaCore文件,这些文件对故障排查至关重要。 #### 二、DB2客户端集成与配置 若应用涉及与DB2数据库的交互,需特别注意以下几点: - 若DB2为远程64位数据库,应在...