I recently had a single Java thread out of my confluence instance run away from me. Using top -H, I could see that this thread was consistently running CPU usage up to 99.9% while all the others appeared normal.
Is there any way I can map this thread to a single user or to a single IP address or to a single task. Perhaps next time this happens I can ask the user to stop what they are doing and log out rather than restart the entire Confluence service for everyone.
For the googlers,
I found this script elsewhere and it did the trick:
#!/bin/bash PID=$(top -n1 | grep -m1 java | perl -pe 's/\e\[?.*?[\@-~] ?//g' | cut -f1 -d' ') echo The PID of the Confluence process is $PID TID=$(top -n1 -H | grep -m1 java | perl -pe 's/\e\[?.*?[\@-~] ?//g' | cut -f1 -d' ') echo The PPID of the highest CPU consuming Java thread is $TID NID=$(printf "%x" $TID) echo The hex value of the highest CPU consuming Java thread is $NID if [[ $PID -gt 0 && "$NID" != "0" ]]; then sudo /usr/java/jdk1.6.0_20/bin/jstack $PID | grep -A500 $NID | grep -m1 "^$" -B 500 fi; echo -n "OS thread count is: " ps -eL | grep java | wc -l echo -n "Open file count is: " sudo /usr/sbin/lsof | grep java | wc -l echo -n "Total established connection count is " sudo /usr/sbin/lsof -i | grep java | grep -i established | wc -l echo -n "HTTPS incoming connection count is: " sudo /usr/sbin/lsof -i | grep java | grep -i established | grep :https | wc -l echo -n "Total other (outgoing) connection count is: " sudo /usr/sbin/lsof -i | grep java | grep -i established | grep -v ":https" | wc -l echo -n "Database (outgoing) connection count is: " sudo /usr/sbin/lsof -i | grep java | grep -i established | grep "dbServer" | wc -l
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.