0 preparations jstat (Java Virtual Machine Statistics Monitoring Tool, run data Monitoring Tool) is particularly powerful and has many options to view the usage of each part of the heap in detail, and the number of loaded classes. Jvmstat is a graphical version of jstat's memory collection function. It is intuitive and practical. Therefore, this article describes how Jvmstat can monitor JVM memory locally and remotely. Two preparations are required: 1) download and install sun jdk. 2) learn how to view the jvm instance process id (pid ). You can use the jps (Java Virtual MachineProcess Status Tool to view the JVM Process Status) in % JAVA_HOME % \ bin to view the local JVM process without entering any parameters. The trouble is to find the java Process id through the windows Task Manager or find the pid through ps aux | grep java in linux. 1 monitor local JVM memory 1.1The Windows system command is: % jvmstat_home % \ bat \ visualgc. mongopid pid is the process id of the jvm instance to be monitored. 1.2Linux command: % jvmstat_home % \ bin \ visualgcpid pid is the process id of the jvm instance to be monitored. Note the need to authorize visualgc. 2 monitoring remote JVM memory 2.1 is monitored host configuration here jstatd tool (jstat daemon program, remote monitoring using RMI) is required ). Deploy and run jstatd on the monitored host. The command is as follows :. /jstatd-J-Djava.security.policy = all. policy in general, there will be problems here, that is, the permission problem. Sun's website provides related solutions, as follows, in % JAVA_HOME %/jre/lib/security/java. add the following code to the policy file: grant codebase "file :$ {java. home }/.. /lib/tools. jar "{permissionjava. security. allPermission;}; then restart the jstatd process. Note: Do not close the command prompt or terminal that plays the jstatd process; otherwise, the monitoring and monitoring daemon will be disabled. 2.2 monitoring host configuration use jps to check which JVM processes are in use on the remote machine. The command is as follows: jps172.7.9.201 // the IP address or name of the remote machine, for example, output: [html] 19727 JConsole 20454 Jstatd 19171 ZooKeeperMain 19685 LogServerStartStopApp such as 1.1 and 1.2 operate Jvmstat on windows and linux respectively. Command: The Jstatd process on the remote machine has been started. % Jvmstat_home % \ bat \ visualgc.cmdpid@172.7.9.201 % jvmstat_home % \ bin \ visualgcpid@172.7.9.201 pid is the process id of the jvm instance to be monitored. After successful execution, you will be able to see a java monitoring window (which looks very professional). At this time, you can start monitoring.