Saturday, March 31, 2012

OUT OF MEMORY ERROR

Let us continue our series of posts about solving the OutOfMemoryError in our hypothetical production system.

We have described different methods to tackle the problem, and today's post concentrates on what you can learn from heap dumps. Spoiler alert: with a bit of luck, you can get very close to solving the OOM :)

In retrospect, these are the methods we have already tried:

  1. We have added more physical memory to that machine. Nothing changed.
  2. We have attached memory profiler to it. Our application became ten times slower, and lived ten times longer.
  3. We have wrestled with command line tools and saw some magic numbers.

None of them actually helped us solve the actual cause of the problem. Today we will try the next weapon in our arsenal: the memory dumps and the tools that help you work with them - the memory dump analyzers.


Just one more remark before we begin – note that some authors use the term “heap dump” for describing memory dumps. In the Java world, most of the time heap dump and memory dump mean the same thing. I in this post I will use them both interchangeably.

What is a "memory dump"?

Memory dump is a snapshot of Java Virtual Machine’s memory, taken at one specific moment. Usually it is saved on the disk for further analysis.

Using the dump, JVM memory contents can be investigated at developer’s leisure, using a wide range of tools, in the developer’s comfortable environment far away from the sensitive production site. The ultimate goal of that investigation is to find objects that consume too much memory and where those objects are being held in the running application.

The practical examples below will once more be based on our sample leaking PetClinic application, distributed with the Plumbr release package.

How can you create the memory dump?

The memory dump can be created in two ways:

  1. By adding “-XX:+HeapDumpOnOutOfMemoryError” to your java start command, like this:java -XX:+HeapDumpOnOutOfMemoryError -Xmx512m ...When you start your JVM like this, whenever an OutOfMemoryError (OOM) is thrown by the JVM, a full memory dump will be written to the disk just before crashing/exiting/whatever your JVM does at an OOM.

    Although waiting for the JVM to crash before starting to look for the causes of the problem could be a little harsh, I strongly suggest that no JVM run in production without this parameter. Let me stress that again:
    Go and add that parameter in your production server configuration now! The reason is very straightforward: if your production server would ever suffer from an OutOfMemoryError, you will want to possess that memory dump. It will be the most useful data for postmortem analysis and often the dump alone will be sufficient to find out the cause of the crash.


Struggling for corruption

We are leaving in a time where people are struggling to become appropriately corrupt. Just like lake of opportunities in any other sector , this sector is heavily loaded with tremendous supply and dwarfing requirement. You need to be highly sophisticated , well earned , broadly linked to a no of high profile people to make a way in corruption industry . So where do the people go Who can't find themselves befitted for this populous way of surviving . Honesty does not bring anything to them, corruption they don't qualify for , Stronger they are not enough to be Robin Hoods , Beggars they are not , Unemployment they are , self sustaining business requires a coordinated support of corruption ,which they don't qualify for . Worst thing is no of people falling in this category is substantial . How will people belonging to this class make their way to life. Does anyone think about these people who are suffocating for nothing and everything . These people have no fault of their own but they are punished hardest by their fate. God only knows what is expected from these people expect testing their patience , honesty , truthfulness and struggle before they live their last breath. Its very dramatic and strange world where a set of people have become burden on another set of people

Monday, March 12, 2012

Kejriwal is back on news channel after long wait

Election time is over and Kejriwal is back with his own set of analysis on election results. According to Arvind it UP and punjab it was totally anti-corrupption wave. In U.P. people had no choice but to choose anti incumbency factor. All in people has casted congress out with very poor mandate . Now UPA should bring a strong lokpal as soon as possible otherwise congress will be biting dust in general election and they will be totally out of power. Congress has shown huge disrespect to Anna ,Ramdev and general public in general So it is inevitable for congress to get thoroughly isolated sooner than later. SO in Arvind's words Congress need to tighten up its shoes very firmly and very swiftly

Friday, January 1, 2010

BEST MOVIE OF 2009

FOR ME : IT DOES TO BE 3 IDIOTS. AND THATS NOT FOR SINGLE REASON