Tuesday, October 8, 2013

Program performance and resources consumption - JConsole

As a software developer, you might want to know the performance of and the resources used by your program so that you can improve it or recommend to the user the CPU speed and size of memory that the user' computer needs to properly run your program.

Java provides a utility called JConsole that can be used to get the information about your program's performance and resources consumption. These information include the number of threads (sub-processes) currently used by the program, the number of deadlock threads (sub-processes hanging), the number of classes loaded and unloaded, the time consumed by the program since it started, the time taken to compile the program, the currently memory size used by the program and the memory size guaranteed available to the program, etc.

To start the JConsole utility for your Java program, you will follow the steps below.
-Run your Java program
-Open the command prompt window and type jconsole



start JConsole


-The Java Monitoring and Management Console displays. Double-click the name of your program or click the Connect button to display the Java Monitoring and Management Console for the program.

JConsole connecting to a process


If your program is running on the remote machine, you need to select Remote Process instead of the Local Process. Enter the remote host name followed by colon and the port number (hostname:port). You might need to provide the user name and password to connect to the remove host.

On the Monitoring and Management Console interface, there are six tabs-Overview, Memory, Threads, Classes, VM Summary, and MBeas. The Overview tab provides general information about memory usage, threads used, classes loaded and unloaded, and CPU usage.


jconsole overview



The Memory tab provides detail information about memory usage. The Threads tab tells you more information about threads run in the program. The Classes tab provides more information about classes loading. The VM Summary shows you the summary information about the Java Visual Machine including process id and name, CUP time, free memory, memory in use, total memory, garbage collection, OS related information, the path of the class file of the program, the path of the libraries to search when loading the libraries, and the boot path used by the bootstrap class loader to search for class files. With MBeans tab you can access the full set of the information including what available and not available in other tabs.

2 comments:

  1. Your information is very useful, I will proceed to launch JConsole now!

    ReplyDelete
  2. I’d should check with you here. Which isn't one thing I usually do! I take pleasure in reading a put up that can make people think. Additionally, thanks for allowing me to comment!japanese watch brands

    ReplyDelete