Thread stack summary

1. jstack command

View thread stack information within a Java process.

jstack can locate the thread stack, the stack according to the information we can locate specific code , so it is very much in use JVM performance tuning.

2. Hot CPU issues:

cpu occupancy rate has continued relatively high

Positioning steps:

jps -m -l list the running processes ---- whether here with the top command better? top to see who occupied the highest cpu                       

top -H -p pid process to find the most cost within the cpu thread

printf "% x \ n" tid thread id into hexadecimal

jstack pid | grep converted to hexadecimal tid -A 50

Note 1: The information shown, focusing on the code I have written, to develop screenshots

Note 2: There may be a jstack not capture the information you need, you need to perform many times, because the state is caught in the moment

3. java.lang.stackoverflowerror,fatal:stack size too small

  • Parameters: -Xss: stack size for each thread that holds the function call, such as the return address, the default 1M, if error, instead 2M

  • Code: capturing memory snapshots, go to troubleshoot the code, there may be too many levels of recursive calls

    image.png

Guess you like

Origin blog.51cto.com/11009785/2406307