Difference between revisions of "Java"
From Vague Hope Wiki
(→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 03:31, 29 September 2015
Profiling
-Xrunhprof:cpu=samples,depth=7,file=/tmp/app-profile.txt -jar foo.jar kill -QUIT $pid
- http://docs.oracle.com/javase/7/docs/technotes/samples/hprof.html
- http://www.brendangregg.com/blog/2014-06-09/java-cpu-sampling-using-hprof.html
- https://github.com/jnorris/conf/blob/master/bin/hprof#L113
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
- http://linux.die.net/man/1/jmap-java-1.6.0-openjdk
- http://www.eclipse.org/mat/
- http://vault.centos.org/6.4/updates/x86_64/Packages/
Remote Debug Tomcat6
In /usr/sbin/tomcat6:
-Xdebug -Xrunjdwp:transport=dt_socket,address=62277,server=y,suspend=n
GC
- http://mechanical-sympathy.blogspot.co.uk/2013/07/java-garbage-collection-distilled.html
- http://www.oracle.com/technetwork/java/javase/gc-tuning-6-140523.html
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 \
- http://stas-blogspot.blogspot.co.uk/2011/07/most-complete-list-of-xx-options-for.html
- https://blog.codecentric.de/en/2013/01/useful-jvm-flags-part-6-throughput-collector/
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