SyntaxHighlighter

Showing posts with label Java. Show all posts
Showing posts with label Java. Show all posts

Friday, December 7, 2012

Part 3: Garbage Collection - Troubleshooting OutOfMemory Issue

Overview:
In Part 2 of this series, we have seen different types of garbage collectors , heap memory and how to configure them using JVM options. Also we have seen how to enable GC logs by setting different options to get more and clear information about the JVM.
In this last part of this series, we will end our "GC trip journey" by looking what to do when an OutOfMemory issue happens
  1. How to troubleshoot and
  2. Tools to use

Part 2: Garbage Collection - Nuts and Bolts

Overview:
In Part 1 of this series, we have seen that java memory model has a Heap and a Stack and also how local variables and objects gets created on stack or heap and destroyed by garbage collector when their references go out of scope.

In this series, we will see
  1. Types of Garbage Collector and their configuration.
  2. Heap Memory and how to configure the size.
  3. Types of Garbage Collections.
  4. JVM Options for GC.
  5. How to read GC Logs.

Part 1: Garbage Collection - Basics

Overview:
In java world, Garbage Collection is one of the most important areas which is often overlooked by developers. But its fun to watch when it drives you nut when JVM starts running with low memory or Out Of Memory due to memory leak. Memory leak can happen due to our application or third party libraries or vendor product issue etc…(no one is perfect in this world).

Early this year, despite of having 2GB heap size, our weblogic 10.3.2 server running with JDK1.6_29 was crashing every hour or so due to OutOfMemory error. After spending good amount of time and digging it deeper, we found that it was happening due to huge amount of memory being used by weblogic’s proprietary or default SSL API i.e. “certicom”.
During investigation, I learned a lot about monitoring memory, taking heap dumps and tools to use to browse dump files. I thought of sharing my experience, so that others can benefit from same.