Tools and commands that may be useful for Java troubleshooting

Tools and commands that may be useful for Java troubleshooting

――I put it together for myself

Java process list (jps)

You can see the process list of java

$JAVA_HOME/bin/jps

# -See more details in v. Options passed at startup, etc.
97312 RemoteMavenServer
97399 WSSampleMain
97398 Launcher
97403 Jps
81229 sbt-launch.jar
97005
97324 NailgunRunner

Stack trace (Thread dump) (jstack)

$JAVA_HOME/bin/jstack $Process number

# -You can get it even in the process that hangs in F

heap dump(jmap) Can be taken with the jmap command

$JAVA_HOME/bin/jmap -histo $Process number
#What and how many objects are in memory? What is the size? Get out

$JAVA_HOME/bin/jmap -heap $Process number
#You can see the situation of heap

jcmd

The guy who put it together

https://www.ibm.com/developerworks/jp/java/library/j-5things8.html

Convenient tool

JMC ――You can see the stack, heap, etc. in GUI.

jvm-mon --Graphical view of CPU usage, processes, Threads and heap specifications on the terminal

Java option

When the JVM crashes in OOM, heap dump is issued without permission

java -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=$Discharge destination directory

Drop the GC log

How to read the log

--When you say GC, other than Full GC --Full GC is as its name suggests --~~ K-> ~~ K is the amount of memory used before and after

Output to standard output

java -verbose:gc

Issued to a file

java -Xloggc:./gclog/gc.log
option

Recommended Posts

Tools and commands that may be useful for Java troubleshooting
[Beginner] Commands and knowledge that may be useful for error resolution when deploying AWS
Posts that may be useful for JNI beginners
Problems that can easily be mistaken for Java and JavaScript
This and that for editing ini in Java. : inieditor-java
Java while and for statements
Java for beginners, expressions and operators 1
Java for beginners, expressions and operators 2
Spring Framework tools for Java developer
This and that about Base64 (Java)
Classes and instances Java for beginners
Lock_version may be used for tables that tend to access and edit the same record at the same time
Java code that cannot be used from Kotlin (for in-house study sessions)
Performance analysis and failure diagnostic tools that can be used with OpenJDK
Problems that can easily be mistaken for Java and JavaScript
[Java] for Each and sorted in Lambda
[About JDBC that connects Java and SQL]
[Java] Proxy for logging SQL and SQL results
Technology excerpt that can be used for creating EC sites in Java training