All Projects → cqsupport → jstackSeries.sh

cqsupport / jstackSeries.sh

Licence: Apache-2.0 license
Script for capturing a series of thread dumps from a Java process using jstack (on Linux and Windows)

Programming Languages

powershell
5483 projects
shell
77523 projects

Projects that are alternatives of or similar to jstackSeries.sh

Docs
Java知识总结:MySQL实战45讲,多线程和JVM知识总结,,SpringBoot,SpringCloud,Storm系列,微信小程序开发,ELK,《JAVA核心技术36讲笔记》,《深入理解JVM虚拟机笔记》,《高性能MySQL笔记》,《数据结构与算法》等等
Stars: ✭ 308 (+1000%)
Mutual labels:  jvm, jdk
go-jdk
Run JVM-based code in Go efficiently
Stars: ✭ 61 (+117.86%)
Mutual labels:  jvm, jdk
cryostat
Secure JDK Flight Recorder management for containerized JVMs
Stars: ✭ 147 (+425%)
Mutual labels:  jvm, jdk
Quickperf
QuickPerf is a testing library for Java to quickly evaluate and improve some performance-related properties
Stars: ✭ 231 (+725%)
Mutual labels:  jvm, profiling
Javacore
☕️ JavaCore 是对 Java 核心技术的经验总结。
Stars: ✭ 909 (+3146.43%)
Mutual labels:  jvm, jdk
Java Multi Thread Programming
🏆 《Java多线程编程核心技术》📚(高洪严 著 机械工业出版社) 源码 https://loveincode.github.io/java-multi-thread-programming/
Stars: ✭ 325 (+1060.71%)
Mutual labels:  jvm, thread
probes-api
Software Activity Metering - Probes Open API
Stars: ✭ 31 (+10.71%)
Mutual labels:  jvm, profiling
Javaok
必看!java后端,亮剑诛仙。java发展路线技术要点。
Stars: ✭ 867 (+2996.43%)
Mutual labels:  jvm, jdk
Rexlin600.github.io
系列博客、涵盖领域广、不定时更新、欢迎加入
Stars: ✭ 102 (+264.29%)
Mutual labels:  jvm, jdk
doc
QuickPerf documentation: https://github.com/quick-perf/doc/wiki/QuickPerf
Stars: ✭ 22 (-21.43%)
Mutual labels:  jvm, profiling
Thread
type safe multi-threading made easier
Stars: ✭ 34 (+21.43%)
Mutual labels:  thread
awesome-env-config-cn
各种开发语言项目环境国内(中国国内加速镜像)配置教程和部分实践经验,包括github.com, nodejs,npm,nvm, yarn, java, maven, gradle, python, mysys2, elasticsearch, php,golang等等,更多正在加入中...
Stars: ✭ 50 (+78.57%)
Mutual labels:  jdk
oracle-jdk-portable
🚀 Oracle JDK portable for Windows
Stars: ✭ 24 (-14.29%)
Mutual labels:  jdk
java2typescript
Java Processor to generate Typescript Definition from Java classes - This is to help developing on JVM javascript engine (ie Nashorn) using Typescript
Stars: ✭ 24 (-14.29%)
Mutual labels:  jvm
golden
a benchmark for compile-time and/or runtime Nim 🏆
Stars: ✭ 28 (+0%)
Mutual labels:  profiling
burp-aem-scanner
Burp Scanner extension to fingerprint and actively scan instances of the Adobe Experience Manager CMS. It checks the website for common misconfigurations and security holes.
Stars: ✭ 60 (+114.29%)
Mutual labels:  aem
LLVM-JVM
[W.I.P] A Just-In-Time Java Virtual Machine written in Haskell
Stars: ✭ 22 (-21.43%)
Mutual labels:  jvm
cookbook-cq
Chef cookbook for Adobe CQ (aka AEM)
Stars: ✭ 20 (-28.57%)
Mutual labels:  aem
CorePartition
Universal Cooperative Multithread Lib with real time Scheduler that was designed to work, virtually, into any modern micro controller or Microchip and, also, for user space applications for modern OS (Mac, Linux, Windows) or on FreeRTOS as well. Supports C and C++
Stars: ✭ 18 (-35.71%)
Mutual labels:  thread
mbkp
Mikrotik backup script | simple bash script for doing encrypted backups of mikrotik devices(Routeros) via ssh. Script will do password-protected binary and encrypted with openssl export on regular basis
Stars: ✭ 21 (-25%)
Mutual labels:  bash-script

jstackSeries.sh

Bash jstack script for capturing a series of thread dumps from a Java process on Linux.

Just run it like this:

sudo -u java-process-user-id sh jstackSeries.sh pid [[count] delay]

For example: sudo -u javauser sh jstackSeries.sh 1234 10 3

  • javauser is the user that owns the java process
  • 1234 is the pid of the Java process
  • 10 is how many thread dumps to take
  • 3 is the delay between each dump

Note:

  • The script must run as the user that owns the java process.
  • The top output has the native thread id in decimal format while the jstack output has the "nid" in hexadecimal. You can match the thread id (PID) from the top output to the jstack output by converting the thread id to hexadecimal. This provides CPU profiling at the Java thread level.

jstackSeriesAEM.sh

Bash jstack script for capturing a series of thread dumps from an Adobe Experience Manager Java process on Linux.

Make these modifications to the script:

  • Update the JAVA_HOME variable to point to the path of where java is installed.
  • Update the AEM_HOME variable to point to the path of where AEM is installed.

Just run it like this:

sudo -u aem-process-user-id sh jstackSeriesAEM.sh [[count] delay]

For example: sudo -u aemuser sh jstackSeriesAEM.sh 10 3

  • aemuser is the user that owns the java process that runs AEM
  • 10 is how many thread dumps to take
  • 3 is the delay between each dump

Note:

  • The script will automatically try to get the AEM process' PID. It will first look for ${AEM_HOME}/crx-quickstart/conf/cq.pid, if that file is non-existent or empty it would fail over to "ps -aux | grep $AEM_JAR" where variable $AEM_JAR is the name of the jar file. If it fails with both of those it would report an error.
  • Thread dumps and top output would automatically be generated under crx-quickstart/logs/threaddumps in a subfolder with the PID and a timestamp in the name.

MS Windows - Powershell Script

NOTE - Makes the assumption that jstack is on the Windows Environmental Variables PATH

Usage

Command:

jstackSeries_powershell.ps1 <pid> <num_threads> <time_between_threads_seconds>

Step 1

Provide the script the location of jstack.exe via one of the following methods:

  1. Add the JDK bin folder to the windows Path and reopen the powershell.
  2. Set the JAVA_HOME environment variable to the JDK home directory and reopen the powershell.
  3. Or modify the jstackSeries_powershell.ps1 script and set the script:jstackbin variable to the full path of jstack.exe.

The "TOP" output is not similar to the Linux top output and there's some things to understand.

Regular expressions to match "long" running threads.

CPUTime \(Sec\)        : ([0-9]{2,}\.[0-9]{1,}) 
CPUTime \(Sec\)        : ([0-9]{3,}\.[0-9]{1,})

$ProcessThread.TotalProcessorTime

A TimeSpan that indicates the amount of time that the associated process has spent utilizing the CPU. This value is the sum of the UserProcessorTime and the PrivilegedProcessorTime.

$ProcessThread.UserProcessorTime

User CPUTime (%)

A TimeSpan that indicates the amount of time that the associated process has spent running code inside the application portion of the process (not inside the operating system core).

$ProcessThread.privilegedProcessorTime

System CPUTime (%)

A TimeSpan that indicates the amount of time that the process has spent running code inside the operating system core.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].