Datavail’s new white paper “The Essential Guide to Informatica Health Checks & Performance Tuning” helps you get the most out of your Informatica PowerCenter platform for data integration. In the white paper, we discuss essential tools like jmap for diagnosing and resolving problems when running Java processes. This article will discuss how to use jmap for tuning the performance of Informatica.
Thanks to the Java Virtual Machine (JVM) and its “write once, run anywhere” philosophy, Java is one of the most portable and flexible programming languages on the planet. However, Java is also susceptible to memory leaks and other inefficiencies that can make your applications crash or deteriorate in performance.
The good news is that you have jmap: a command-line tool for optimizing your Java processes’ memory footprint. jmap can be used either by itself on an ad hoc basis, or as part of performance tuning for applications like Informatica PowerCenter. So what is jmap exactly, and how can you use it to fine-tune your applications’ performance?
What is jmap?
jmap (written in all lowercase) is a command-line utility that can print memory maps or heap memory details of a given Java process.
The jmap tool has been available since Java 6. However, since the release of Java 8 in 2014, Oracle has also introduced the similar jcmd utility, which it claims has “enhanced diagnostics and reduced performance overhead.” In this article, we’ll discuss both jmap and jcmd.
Java and other programming languages divide memory into two categories: the stack and the heap. The stack is used for static memory allocation, i.e. operations in which the size of the memory required is known in advance.
The heap, on the other hand, is used for dynamic memory allocation at runtime, i.e. operations in which the size of the memory required is not known ahead of time. Allocating memory on the heap is largely done by use of the “new” operator in Java.
When a Java application has a memory leak, the size of the memory occupied on the heap continues to grow unbounded, even though it’s not necessary for the application. This doesn’t just waste the application’s resources–it can also cause it to slow down, hang, pause, and even crash entirely. In this case, you may encounter a mysterious java.lang.OutOfMemoryError.
jmap and jcmd are intended to isolate and identify memory leaks and other issues with heap memory in Java. jmap can provide information such as:
- The heap size
- The size of the Eden space (the memory where the newest objects are created)
- The size of the Young Generation (the memory that contains relatively new objects, which includes both the Eden space and objects that have left the Eden space)
In the next section, we’ll discuss how to use jmap and jcmd.
How to Use jmap
jmap is run from the command line by passing the process ID of the Java VM that you want to analyze, along with any optional arguments. The basic structure of the command is:
jmap [options] pid
The options available in jmap are:
- -heap: Prints a summary of the heap. The summary includes the heap configuration, the garbage collection algorithm used, and the heap usage per each generation.
- -histo: Prints a histogram summary of the heap. The summary includes the number of objects of each class, the class name, and the total memory size in bytes for each class.
- -permstat: Prints statistics about the heap’s permanent generation (the part of the heap that contains Java objects associated with classes and immutable strings).
Using no option will simply print the shared object mappings in the JVM. You can also use the -dump flag to dump the serialized Java heap to a specified filename. For more information, see the link above.
You can replicate the functionality of jmap in jcmd with the following commands:
- To print a histogram summary (as with jmap -histo), type jcmd GC.class_histogram filename=Myheaphistogram.
- To print a heap dump (as with jmap -dump), type jcmd GC.heap_dump filename=Myheapdump.
If you need more information about using jmap with Informatica specifically, you can consult this Informatica video.
jmap and jcmd are highly valuable tools for examining and optimizing your Java processes’ memory footprints. However, they’re just a small piece of the puzzle when it comes to fine-tuning applications like Informatica.
Read This Next
In this white paper, we’ll go over everything you need to know to perform health checks and optimize the performance of your Informatica deployment.
This blog post discusses the release of Oracle Analytics Cloud, a service that includes Essbase Cloud, Business Intelligence Cloud and Data Visualization Cloud.