≡ Menu

APM

Ten things you need to know about Java memory leak

Java memory leaks can be deadly, and difficult to troubleshoot. Are you one of those shops where you restart your Application Servers at regular intervals (weekly, daily or more frequently)? It is pathetic, is it not? Wait a minute, gone are the days where we had 128 MB memory on servers. We have several giga bytes of memory on servers, don’t we? Why do we still run into memory issues? Good question. But sad truth is there are several reasons why Memory leak is not something that will go away. All you can do is to prepare yourself. And that’s what this article is about. Let’s dive into 10 things you need to know about Java memory leak.

1.  Java Heap Memory leak is different from Native Memory leak

Java heap is where the objects created by your application live. The maximum heap is determined by the –Xmx flag of the Java command line that starts the application. If you write code that leaks memory, there is where it will blow up.

Read More

How to create custom monitoring dashboards in AppDynamics?

Custom Dashboard is one of the most powerful features of AppDynamics. It lets you group monitoring metrics that are relevant (and make sense to the user) in one central dashboard. Custom Dashboards are ‘read only’ elements. So, you don’t have to worry about users updating any Appdynamics configuration. You can build sophisticated dashboards with drill down capabilities.

To create a new custom dashboard, click on the icon at the top and choose ‘Custom Dashboards’ as shown below

In the resulting screen, click on ‘Create Dashboard’

Read More

How to instrument a Java application with AppDynamics?

Agent is a vital part of Appdynamics framework. It is the agent that acts like a workhorse to pull metrics from the Application and push it to the Controller. Agent is a piece of software that is installed ON your application. The only function of the agent is to pull the monitoring metrics and send them to the AppDynamics Controller where the data is crunched and made available via the Controller UI. Note that there is NO need of a code change in your application. There is however a setup/configuration change required depending on the platform. In this article, I will explain how to instrument a Java Application.

Read More

A log file is the single most important piece of resource you need in order to tackle almost any problem with your application. I still remember having to troubleshoot complex application performance issues when APM tools were not yet born. All I had were access.log and error.log from a Web Server, standard out and standard error file from the application, and the syslog from the host OS. And guess what? They were more than enough to see what was going on.

But gone are the good old days. The complexity software and hardware infrastructure on which applications are presently deployed is beyond imagination. Application infrastructure is increasingly becoming sort of ‘black box’, and having the right tools to gain insight to this black box is mission critical.

Two parallel set of management software have emerged:

Read More

Configuring Alerts in AppDynamics

What good is an APM solution without a solid Alerting system that is easy to configure? Appdynamics alerting system is very robust with lots of options to customize.

First of all, AppDynamics comes with several pre built alerts with thresholds that are dynamically learned. This means without configuring anything, you get out-of-the-box alerting. This default alerting is visible in the Dashboard via the coloring scheme (for example, a node icon turning RED). However, the default alerting is not enough for most cases. You would want to customize the default ones, and perhaps add your own.

Two major components of Appdynamics Alerting system

Read More

Finding your way in AppDynamics Controller UI

Appdynamics controller UI is very versatile, responsive and easy to use. But at times, it might look like you are beating around the bush but not getting to what you really want. For example, you can easily get lost in the amount of transaction snapshots available to you. (All you have to do is use the ‘search’ box at the top right to filter out the Transaction snapshots). In this tutorial, I’ll show you the most frequently used parts of the Controller UI.

The opening Screen

The Flow map (the mighty Dashboard that you don’t have to build)

Read More

Introduction to APM: Benefits of APM

So, what can an APM tool buy you? Setting aside the hypothetical ‘Peace of mind’ marketing pitch, let me show you how exactly an APM tool can help you support your Application effectively

1. Historic Monitoring of Key Metrics

APM tool can record the monitoring metrics which are invaluable in troubleshooting. For example, take a look at the ‘response time’ graph of a particular application. You can readily see that the application suffers during business hours.

Historic

Read More

Introduction to APM (Application Performance Management)

Back in the 90s when I was working as a Solaris/HP-UX Administrator, all I needed was two or three commands to figure out what was wrong with a particular Server or Application. I will just glance at ‘vmstat’, ‘iostat’ and ‘top’ for a minute or two and the problem will reveal itself clearly. While those command still prove valuable at a certain level, in order to answer ‘Why is the application slow’ you need much more than just few OS commands.

Read More

Troubleshooting GC: Test your knowledge – Answers

Answers

1. The Java command line option to enable Verbose Garbage Collection is:

a. –DenableVerboseGC=true
b. –verboseGC=yes
c. –verbose:gc
d. –enable.verbose.gc
e. –XX:+VerboseGC

Answer: c

Explanation: -verbose:gc is the correct answer. All other options are invalid

2. Short lived and Long lived Java objects are stored in these regions of Heap, respectively

a. Tenured,OldGen
b. OldGen,Tenured
c. Tenured,newGen
d. YoungGen,OldGen
e. Tenured,nursery

Answer: d

Explanation: Short lived objects live in Young Generation (also known as nursery or new generation). When minor garbage collection cannot reclaim memory from objects that are still being used (referenced), they get moved to Old gen (via another hop at survivor space). Old gen is also known as tenured gen.

3. Your application uses lots of File Handles. The memory used to maintain these File Handles are stored in which part of JVM memory

a. PermGen
b. YoungGen
c. Tenured
d. OldGen
e. Native Memory

Answer: e

Explanation: Native memory is used for all Operating system level components (such as File handles, sockets etc). Native memory is also used for any native code (such as C libraries) that runs as part of your application. PermGen is used for Class objects (and in some versions, interned strings). Young,Tenured (oldgen) are used to store your application java objects.

4. You have just deployed a new Java application with ONLY out of the box tuning parameters. Upon using the application, users complain your application is extremely slow. By reviewing the verbose GC log file, you have identified that the frequency of GC is extremely high (once every few seconds). What is your best next step ?

a. Tune –Xms and –Xmx to provide reasonable amount of memory
b. Schedule regular automatic restarts of your application
c. Restart your application
d. Increase PermGen Space
e. Add CPU to your Host Server

Answer: a

Explanation: The default Max heap is not enough in most cases (this various by implementation, but typically 128 or 256 MB). So, the best action is to first increase the max heap (-Xmx). You may want to set –Xms (initial heap) to the same value as –Xmx if possible. Otherwise, you can go with half or ¾ th of the Max heap.

5. Your application just ran out memory (OutOfMemory Error) and it has produced a big heap dump file. What is the best tool to analyze this heap dump to find out what is filling up the memory

a. Verbose GC logs
b. Thread Dump analyzer
c. Eclipse MAT (Memory Analyzer)
d. IBM Pattern Modeling and Analysis Tool for Java garbage collector
e. Jstack

Answer: c

Explanation: Eclipse MAT (Memory Analyzer) is the tool to be used for analyzing Heap dumps. Verbose GC logs just show the GC activity in detail, Thread dump analyzer is for analyzing Thread dumps, IBM PMAT is for visualizing verbose GC logs and finally jstack is a command line tool that comes with JDK that can be used to take thread dumps on a running Java application.

Previous: Troubleshooting GC: Test your knowledge

Troubleshooting GC: Test your knowledge

Test your knowledge on Troubleshooting Java Garbage Collection

1. The Java command line option to enable Verbose Garbage Collection is:

a. –DenableVerboseGC=true
b. –verboseGC=yes
c. –verbose:gc
d. –enable.verbose.gc
e. –XX:+VerboseGC

2. Short lived and Long lived Java objects are stored in these regions of Heap, respectively

a. Tenured,OldGen
b. OldGen,Tenured
c. Tenured,newGen
d. YoungGen,OldGen
e. Tenured,nursery

3. Your application uses lots of File Handles. The memory used to maintain these File Handles are stored in which part of JVM memory

a. PermGen
b. YoungGen
c. Tenured
d. OldGen
e. Native Memory

4. You have just deployed a new Java application with ONLY out of the box tuning parameters. Upon using the application, users complain your application is extremely slow. By reviewing the verbose GC log file, you have identified that the frequency of GC is extremely high (once every few seconds). What is your best next step ?

a. Tune –Xms and –Xmx to provide reasonable amount of memory
b. Schedule regular automatic restarts of your application
c. Restart your application
d. Increase PermGen Space
e. Add CPU to your Host Server

5. Your application just ran out memory (OutOfMemory Error) and it has produced a big heap dump file. What is the best tool to analyze this heap dump to find out what is filling up the memory

a. Verbose GC logs
b. Thread Dump analyzer
c. Eclipse MAT (Memory Analyzer)
d. IBM Pattern Modeling and Analysis for Java garbage collector
e. Jstack

Coming up: Troubleshooting GC: Test your knowledge – Answers