When we’re profiling application code, there’s one common problem in the Java operating environment that has the potential to affect the entire application: Garbage Collection.
In code creation, Garbage Collection is a function of memory management used to eliminate memory allocation issues and increase productivity. Although the process should free up memory in use, it sometimes creates more problems than it solves. It can create latency and other performance issues.
Chuck Ezell, senior applications tuner at Datavail, explains:
Using JDK Tools
Some of the tools in the Java Developer Kit — jstack, jstat, and jmap — are easy to use and are free. They can be used to profile application code. These tools only run on the terminal and generate useful information, but don’t retain any information. You can resolve this by creating a file of the raw data. Before you go to a new session or revert to a different directory, you can easily move the raw data into a file.
Ezell explains his process:
One means to do this is to use jmap to see the memory footprint, then look at the ebb and flow of memory allocation — which helps monitor Garbage Collection — in jstat. You can use it to look at Garbage Collection and different arguments, or the old memory capacity. By adding a timestamp, says Ezell, you can sample and discover what is occurring over time. This can be applied to a particular JVM to see what the Garbage Collection process is doing to the virtual machine over time.
Reactive, Not Proactive
These specific tools are reactive rather than proactive. You must be there when running a JDK tool and it has to be run when there is a problem. Adds Ezell:
Some other tools able to help monitor the process, but offering differing diagnostic capabilities, are HP Diagnostics and AppDynamics. AppDynamics can profile code, for example, down to the thread stack and exceptions without the need for instrumentation. It also works well with Splunk. You can also schedule automatic and diagnostic sessions that will send you e-mail notifications if too many Garbage Collection events are occurring.
This information should make those chores associated with diagnosing and resolving Garbage Collection issues much easier.
If you need assistance or ongoing help with profiling your code, please contact Datavail to discuss a custom solution for your enterprise.
Image by kadmy/123RF.
Subscribe to Our Blog
Never miss a post! Stay up to date with the latest database, application and analytics tips and news. Delivered in a handy bi-weekly update straight to your inbox. You can unsubscribe at any time.
Most people will encounter this error when their application tries to connect to an Oracle database service, but it can also be raised by one database instance trying to connect to another database service via a database link.
EPM applications help measure the business performance. This post will help you choose the best EPM solutions for your organization’s needs and objectives.