问题
Suddenly I've found out that jstat
is deprecated:
The jstat tool displays performance statistics for an instrumented HotSpot Java virtual machine (JVM). The target JVM is identified by its virtual machine identifier, or vmid option described below.
NOTE: This utility is unsupported and may not be available in future versions of the J2SE SDK. It is not currently available on Windows 98 and Windows ME platforms.
I haven't developed anything on Windows for years, but nevertheless the question is - what should I use instead, which tool (or set of tools) nowadays is considered the best substitute for that kind of monitoring I can get using jstat
?
Update: pure CLI tools are preferable.
回答1:
The documentation says that it's unsupported (not quite deprecated yet) since JDK 5 (which you linked), yet it's still present in JDK 6, 7 and OpenJDK 8. I'm not too worried about its disappearance in the short term, especially since it doesn't have a replacement (jcmd doesn't have an equivalent command).
Besides, the tools and utilities directory says it is supported, except on Windows 98 & ME. Then again it says right above that it's unsupported and experimental..
One caveat though: last time I checked, it didn't support G1, but then, neither did JConsole/JVisualVM. It doesn't mean it can't be adapted.
回答2:
I think you can go for either VisualVM (or) Jconsole
Both are good tools for JVM monitoring.
回答3:
I would recommend Visual VM for Sun JVMs. Get the latest version from SourceForge and install all the plugins. You'll be happy with the visual representation for threads, CPU, memory, etc.
来源:https://stackoverflow.com/questions/12716416/if-jstat-is-deprecated-what-should-i-use-instead