Difference between revisions of "Java"

From Vague Hope Wiki
Jump to: navigation, search
(Profiling)
(OpenJDK Heapdump)
 
Line 15: Line 15:
  
 
  sudo -u tomcat jmap -J-d64 -dump:format=b,file=/tmp/heap.bin 1384
 
  sudo -u tomcat jmap -J-d64 -dump:format=b,file=/tmp/heap.bin 1384
 +
$ sudo -u tomcat jstack 1384 | sudo tee /var/log/tomcat6/stacks.txt
  
 
* http://linux.die.net/man/1/jmap-java-1.6.0-openjdk
 
* http://linux.die.net/man/1/jmap-java-1.6.0-openjdk

Latest revision as of 02:31, 29 September 2015

Profiling

-Xrunhprof:cpu=samples,depth=7,file=/tmp/app-profile.txt -jar foo.jar
kill -QUIT $pid

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
$ sudo -u tomcat jstack 1384 | sudo tee /var/log/tomcat6/stacks.txt

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 \

SSL

java -Djavax.net.debug=ssl:handshake:verbose
all            turn on all debugging
ssl            turn on ssl debugging

The following can be used with ssl:
        record       enable per-record tracing
        handshake    print each handshake message
        keygen       print key generation data
        session      print session activity
        defaultctx   print default SSL initialization
        sslctx       print SSLContext tracing
        sessioncache print session cache tracing
        keymanager   print key manager tracing
        trustmanager print trust manager tracing
        pluggability print pluggability tracing

        handshake debugging can be widened with:
        data         hex dump of each handshake message
        verbose      verbose handshake message printing

        record debugging can be widened with:
        plaintext    hex dump of record plaintext
        packet       print raw SSL/TLS packets