Sometime ago I’ve realized that JVM has two major things, that affects JVM performance the most.
It is Jist-In-Time compilation and, of course, Garbage Collection.
I believe that
jstat is a great tool that show what’s JIT/GC doing right now, and some statistics about JIT/GC activity.
Let’s go to the bussiness.
To start jstat run
jstat operation option PID interval count
- operation is a jstat’s ‘mode’. It can monitor compiler, gc, classes. To get full list of supported operations run
- option can beutify in some sense jstat output.
jstat -twill print timestamp for every line. Timestamp is a time in seconds elapsed from JVM’s start.
jstat -h 3will print header every 3 lines of jstat’s output.
- PID is a JVM’s process id. Actually, as PID you can provide a vmid that is running on remote server. Example
jstat -gccause email@example.com
- interval is a time between jstat measurements. It can be in ms or s. Example
jstat -compiler 4795 1s
- count is a number of jstat measurements
As for me I prefer to use -gccause -compiler modes when using jstat.
1 2 3 4 5 6 7 8 9 10 11