Several essential command-line tools are commonly used for monitoring and managing Java Virtual Machines (JVMs). These include jps, jstat, jinfo, jmap, and jstack. To use these tools, you typically need to install the openjdk-devel-debug package.
You can install it using the following command:
sudo yum install -y java-1.8.0-openjdk-devel-debug
1. jps – Similar to the Linux `ps` command, this tool lists Java processes along with their main class or JAR file. Common options include:
- -l: Displays the full package name of the main class or the full path of the JAR file.
- -m: Shows arguments passed to the main method, which may be null in embedded JVMs.
- -v: Outputs JVM parameters.
Example: jps -lvm
2. jstat – A lightweight tool that monitors JVM statistics, especially useful for detecting memory issues. Its syntax is:
jstat [option] [-t] [-h
Where vmid
refers to the process ID (PID) of the Java application, interval
is the time in milliseconds between samples, and count
is the number of samples.
Common usage: jstat -gcutil 20659 1000 2
The output might look like this:
S0 S1 E O M CCS YGC YGCT FGC FGCT GCT 0.00 99.38 65.57 3.61 97.37 89.84 1 0.015 0 0.000 0.015 0.00 99.38 65.57 3.61 97.37 89.84 1 0.015 0 0.000 0.015
Explanation of the fields:
- S0: Percentage of space used in Survivor Space 0.
- S1: Percentage of space used in Survivor Space 1.
- E: Percentage of space used in Eden Space.
- O: Percentage of space used in Old Generation.
- M: Percentage of space used in Metaspace.
- YGC: Number of Young Garbage Collection events.
- YGCT: Total time spent on Young GC.
- FGC: Number of Full GC events.
- FGCT: Total time spent on Full GC.
- GCT: Total GC time from application start.
3. jinfo – Used to view JVM configuration parameters. For example:
jinfo -flags 20659
This will display VM flags, system properties, and command-line arguments of the running Java process.
4. jmap – Provides detailed information about the memory usage of a Java process. Common commands include:
jmap
: Prints a summary of the heap.jmap -heap
: Displays detailed heap information.jmap -histo:live
: Shows object counts, including only live objects.jmap -dump:format=b,file=mem.dat
: Exports the heap to a file for further analysis.
5. jstack – Used to print thread stacks of a running Java process. It’s particularly helpful when diagnosing deadlocks or performance issues. Usage:
jstack
This will show all threads, their states, and stack traces, allowing developers to identify problematic threads quickly.
transparent LED screens offer a unique and visually striking way to display content while maintaining transparency and visibility. They have gained popularity in recent years and are continuously evolving with advancements in LED technology. Transparent LED screens can be used both indoors and outdoors, depending on the specific model and its level of weather resistance. They are typically lightweight and easy to install, with options for wall-mounted, freestanding, or suspended installations.
Hot-selling serie is P3.91 1000*500mm/1000*1000mm.
Transparent Led Screen,Led Wall Display,Building Led Display Panel,Sport Led Screen
Guangzhou Cheng Wen Photoelectric Technology Co., Ltd. , https://www.cwledwall.com