Performing a thread dump in Linux or Windows--reference
Linux/Unix
1. Find the Java/Tomcat process id.
% ps ax | grep java
You should see output like this
17207 ? Sl 78:36 /usr/java/default/bin/java -Djava.util.logging.config.file=/usr/tomcat/tomcat6/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Xmx1024M -Xms128M -XX:MaxPermSize=256M -Djava.awt.headless=true -Djava.endorsed.dirs=/usr/tomcat/tomcat6/endorsed -classpath :/usr/tomcat/tomcat6/bin/bootstrap.jar -Dcatalina.base=/usr/tomcat/tomcat6 -Dcatalina.home=/usr/tomcat/tomcat6 -Djava.io.tmpdir=/usr/tomcat/tomcat6/temp org.apache.catalina.startup.Bootstrap start
2. Execute the following command to generate a thread dump
% kill -3 <pid>
Run this command every 5-10 seconds, 5 times.
3.The thread dump is written to the standard output. It may logged in the console or <tomcat>/logs/stdout or <tomcat>/logs/catalina.out.
4. If you are running JDK 6.0+, you may also use jstack to produce a thread dump.
% jstack -l <pid> > threaddump.txt
or
% jstack <pid> > threaddump.txt
Windows
Running as a Windows service
1a. If installed using Tomcat installer, click All Programs ->Apache Tomcat 6.0->Monitor Tomcat. An icon should appear in task bar.
1b. If not installed using Tomcat installer, navigate to <tomcat>/bin, and run the following command
% tomcat7.exe //MS//Tomcat7
![]()
The Tomcat monitor icon should appear in the system tray.;
2. Right click the the icon and select Thread Dump.
Run this command every 5-10 seconds, 5 times
3. Look for the thread dump in <tomcat>/logs/stdout or <tomcat>/logs/catalina.out.
Running from startup.bat
1. Open "Windows Task Manager",
2. Find the process ID of the java process
3. Make sure <JDK>/bin is in your command path. Otherwise, navigate to <JDK>/bin
4. Execute the following command to generate a thread dump
% jstack -l <pid> > threaddump.txt
Run this command every 5-10 seconds, 5 times
If you receive an error running jstack such as the below, then you may need to use psexec:
7988: Insufficient memory or insufficient privileges to attach
The -F option can be used when the target process is not responding

.png)

.png)

.png)
Run this command every 5-10 seconds, 5 times
You can also add the full path of your Java 'bin' directory to the server's system path variable. The Java 'bin' directory is usually in 'Program Files\Java\bin\jdk<version>\bin'. If you add this path to the system variable then you will need to restart the command prompt again for the change to be picked up and the 'jstack' command to work.
Performing a thread dump in Linux or Windows--reference的更多相关文章
- 013-程序性能分析之thread dump和heap dump
一.dump基本概念 主要用于故障定位(尤其是out of memory)和性能分析.主要记录了JVM运行期间的内存占用.线程执行等情况,这就是常说的dump文件.常用的有heap dump和thre ...
- 性能分析之-- JAVA Thread Dump 分析综述
性能分析之-- JAVA Thread Dump 分析综述 一.Thread Dump介绍 1.1什么是Thread Dump? Thread Dump是非常有用的诊断Java应用问题的工 ...
- [转]Java Thread Dump 性能分析
Java and Thread 一个 web 服务器使用几十到几百个线程来处理大量并发用户,如果一个或多个线程使用相同的资源,线程之间的竞争就不可避免了,并且有时候可能会发生死锁. Thread co ...
- thread dump
最近在做性能测试,需要对线程堆栈进行分析,在网上收集了一些资料,学习完后,将相关知识整理在一起,输出文章如下. 一.Thread Dump介绍 1.1什么是Thread Dump? Thread Du ...
- 如何抓取Thread Dump小结(转)
当系统性能出现问题时,需要从各个方面来查看网络环境.主机资源.查看最经变更的代码等.如果是想从代码层面解决问题,那么最有效的方法就是查看相关dump文件.如果是使用IBM JDK(我默认你是在aix环 ...
- Thread Dump 和Java应用诊断(转)
Thread Dump 和Java应用诊断 Thread Dump是非常有用的诊断Java应用问题的工具,每一个Java虚拟机都有及时生成显示所有线程在某一点状态的thread-dump的能力.虽然各 ...
- java程序性能分析之thread dump和heap dump
一.dump基本概念 在故障定位(尤其是out of memory)和性能分析的时候,经常会用到一些文件来帮助我们排除代码问题.这些文件记录了JVM运行期间的内存占用.线程执行等情况,这就是我们常说的 ...
- java jvm heap dump及 thread dump分析
一.概念: 在进行java应用故障分析时,经常需要分析内存和cpu信息,也就说所谓的heap dump 和 thread dump heap dump: heap dump文件是一个二进制文件,需要工 ...
- [JAVA]JAVA章4 Thread Dump如何分析
一.Thread Dump介绍 1.1什么是Thread Dump? Thread Dump是非常有用的诊断Java应用问题的工具.每一个Java虚拟机都有及时生成所有线程在某一点状态的thread- ...
随机推荐
- hdu 3062
2-SAT的入门题: 网上说这个算法最好的入门教材是:伍昱的<由对称性解2-SAT问题>的ppt和赵爽的论文<2-SAT 解法浅析>: 看了一下伍昱的ppt,很好理解! 而这道 ...
- 构建简单的 C++ 服务组件,第 1 部分: 服务组件体系结构 C++ API 简介
构建简单的 C++ 服务组件,第 1 部分: 服务组件体系结构 C++ API 简介 熟悉将用于 Apache Tuscany SCA for C++ 的 API.您将通过本文了解该 API 的主要组 ...
- ANDROID_MARS学习笔记_S04_003_用HttpClent发http请求
一.代码 1.xml(1)activity_main.xml <TextView android:layout_width="wrap_content" android:la ...
- 在KEIL中的模块化程序写法
在使用KEIL的时候,我们习惯上在一个.c的文件中把自己要写的东西按照自己思路的顺序进行顺序书写.这样是很普遍的写法,当程序比较短的时候比如几十行或者一百多行,是没有什么问题的.但是当程序很长的时候, ...
- Android用户界面 UI组件--TextView及其子类(四) Chronometer计时器
Chronometer是一个简单的定时器,你可以给它一个开始时间,并以此定时,或者如果你不给它一个开始时间,它将会使用你的时间通话开始.默认情况下它会显示在当前定时器的值的形式“分:秒”或“H:MM: ...
- Android MediaPlayer状态机
对播放音频/视频文件和流的控制是通过一个状态机来管理的.下图显示一个MediaPlayer对象被支持的播放控制操作驱动的生命周期和状态.椭圆代表MediaPlayer对象可能驻留的状态.弧线表示驱动M ...
- while +next 循环 回到循环顶端
my $show_tip = 1; sub login { while (1) { my $api ="https://login.weixin.qq.com/cgi-bin/mmwebwx ...
- Oracle DBMS_SESSION
Version 11.1 General Purpose Try dbms_session.reset_package. This call will reset all packages var ...
- Cookies和Session理论总结
今天主要学习了Cookies和Session,网络上关于这方面的知识可谓很多,让人眼花缭乱,在此作一个小结.本文不讲多,不讲什么高大上的,只是抛出一块砖,讲三个问题:①什么是Cookies和Sessi ...
- Android权限Uri.parse
1,调web浏览器 Uri myBlogUri = Uri.parse("http://xxxxx.com"); returnIt = new Intent(Intent.ACTI ...