Java

From Vague Hope Wiki
Revision as of 01:55, 17 March 2015 by Haku (Talk | contribs) (SSL)

Jump to: navigation, search

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 \

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