

The port mentioned in - .port= is the RMI registry port. You can also generate a thread dump and memory dump on the remote machine from JVisualVM when connected through the JMX Remote port. We can use JVisualVM to connect to the remote machine and view the CPU utilization, memory sampling, threads, etc. We can enable the JMX Remote ports by adding the following system parameters while starting the java application. netstat -plunt -> Network connectivity.lsof –i: tcp -> All the ESTABLISHED and LISTENING TCP connections.lsof -i : -> To check, whether a particular port is open.Some of the important commands for preliminary investigation apart from memory and CPU statistics are as follows. Note: When an application is experiencing slowness or is unresponsive, these commands would be very handy to perform preliminary investigations before jumping into memory and thread dumps. It provides insight into how much memory and CPU each thread utilizes and how long have they been running. This command provides the number of threads in a process and their statistics. It also shows which command has started this process.Į) Thread statistics of the Java process. This command provides the CPU and memory utilization of a process (in our case, the Java application). The following commands provide detailed information about the VM/node’s memory and processors.ĭ) CPU and Memory utilization of a particular process. The above screenshot shows that there are four CPUs (Cpu0, Cpu1, Cpu2, Cpu3) and their utilization statistics. Hitting “1” on the Keyboard, when top is running will show all the available CPUs and the utilization of each CPU. This command provides CPU and memory utilization. This command provides the total free and used memory information of your VM/node. Basic Linux Commands to Monitor Memory and CPU I would want to keep this article as simple and unique as possible and do not want to duplicate the work and effort of my fellow technical comrades. Still, we'll provide appropriate links to documentation and articles, which will have more information about a particular topic. Note: Since this article will be touching base on most of the monitoring techniques, we will try to be precise in illustrating them. We will be using JVisualVM extensively to demo memory and CPU monitoring. I believe, a Java developer should leverage some of these techniques to fine-tune the code and set the right JVM parameters, while taking the code, all the way from development to production. I will be providing details about the nuances of these tools and when and how they could be used. This article talks about the basic commands, tools, and techniques to monitor JVM’s Memory and CPU.
