Difference between revisions of "Java"

From Vague Hope Wiki
Jump to: navigation, search
(OpenJDK Heapdump)
Line 8: Line 8:
 
  sudo jmap -F -J-d64 -dump:live,format=b,file=/root/heap.bin 2232
 
  sudo jmap -F -J-d64 -dump:live,format=b,file=/root/heap.bin 2232
 
  sudo jstack -F 2232 > /root/stacks.txt
 
  sudo jstack -F 2232 > /root/stacks.txt
 +
 +
sudo -u tomcat jmap -J-d64 -dump:format=b,file=/tmp/heap.bin 1384
  
 
* http://linux.die.net/man/1/jmap-java-1.6.0-openjdk
 
* http://linux.die.net/man/1/jmap-java-1.6.0-openjdk

Revision as of 07:29, 13 January 2015

Profiling

-Xrunhprof:cpu=samples,file=/tmp/app-profile.txt -jar foo.jar

OpenJDK Heapdump

sudo yum install java-1.6.0-openjdk-devel
sudo jmap -F -J-d64 -dump:live,format=b,file=/root/heap.bin 2232
sudo jstack -F 2232 > /root/stacks.txt
sudo -u tomcat jmap -J-d64 -dump:format=b,file=/tmp/heap.bin 1384

Remote Debug Tomcat6

In /usr/sbin/tomcat6:

-Xdebug -Xrunjdwp:transport=dt_socket,address=62277,server=y,suspend=n

GC

sudo jmap -heap <pid>
java \
  -Xms300m \
  -Xmx600m \
  -verbose:gc \
  -XX:MaxGCPauseMillis=20 \
  -XX:+UseConcMarkSweepGC \
  -XX:+CMSIncrementalMode \
  -XX:+CMSIncrementalPacing \
java \
  -verbose:gc \
  -XX:+PrintGCDetails \
  -XX:MaxGCPauseMillis=20 \
  -XX:MaxGCMinorPauseMillis=10 \
  -XX:GCTimeRatio=200 \
  -XX:+UseSerialGC \
  -Xms140m -Xmx140m \