≡ Menu

Java Programming

Troubleshooting GC: What is GC and how it works – Part 1

It stinks when you don’t throw away of the Garbage

Every java application, whether it is an one line ‘hello world’ application, or an online banking application with millions of users, needs Physical memory to run. And this memory has an upper limit (sorry, you can’t have the cake and eat it too) which is defined by the parameter –Xmx in the Java command line that starts the application.

Example:

Java –Xmx128m HelloWorld

In the above command, 128M is the maximum memory the HelloWorld application can have. This memory is called Heap and it lives in the memory available in the host operating system. As your program executes, it creates Objects, which occupy memory. JVM allocates this memory using available heap.

Read More

Troubleshooting GC:Introduction

Software needs memory (RAM) to run. Unfortunately memory is limited. This simply means this: Your application must manage the memory usage effectively or it will suffer.

In a Java application, much of the memory management – scratch that – all of memory management is handled by JVM itself. This is great news for the developers as they don’t need to meddle with ‘malloc’,’free’ and the like. However, due to the fact that every application is different, the out- of-the box JVM memory management may not be efficient.

Garbage Collector is the key element in JVM memory management. In order for your application to run at its maximum speed and reliability, Garbage Collector a.k.a GC must be tuned. GC tuning can be a very time consuming process, mainly because,

1. There are plethora of GC tuning options

2. It takes rigorous testing to identify the effectiveness of the tuning

In the following segments, I will explain how Garbage collector works, the various memory related issues that you might face and how to troubleshoot them. I will also show you few handy tools you can use to speed up troubleshooting.

Coming up: Troubleshooting GC: What is GC and how it works – Part 1

Why Java Garbage Collector is NOT a cure-all?

Garbage Collection is a life saver. Sure, you don’t have to mess with malloc() and free() and not worry about accidently deallocating objects that are still being referenced. But is GC a cure-all? Does it save you from all memory issues? Worse yet, can it cause more damage than good? Here are three reasons why GC is overrated:

Read More

The most important JVM memory tuning parameter- and how to ace it.

One of the deadliest errors you can encounter in your Java application is ‘OutOfMemory’ error. The impact this error can have in your application and your business can be enormous. I have seen organizations spend countless hours struggling to fix this error while continuing to have degraded end-user experience (a sure-fire way to lose credibility). One company was actually restarting their application every three hours just to avoid an ugly hang due to OOM. How sad?

In this article, I would like to point out the most important tuning parameter in your Java application. If you get this wrong, no matter how much tuning you put in, you will end up with an OOM sooner or later. Note that there are tons of tuning parameters available to tune the memory. Most of these may not have any effect at all, and some have game-changing effect. The parameter I’m about to reveal is of later kind and the mother of all parameters. This should be the first parameter you should be analyzing to zero-in.

Without further due, here it is.

Read More

In this free ebook, I introduce 9 free tools that can be life savers in managing Java Applications. These tools have been time tested, reliable and have helped countless Application Support Engineers and Developers. They DO WORK. These tools can be used to solve problems ranging from ‘Out Of Memory’ errors to ‘Slow’ Applications.

Enjoy.

Download Free Poster – Important Java command line options

Hi all !

I have put together a one page poster showing the important Java command line options. Download it, print it and stick it in your cube. It will come in handy.

Enjoy !!

PS: It may take about 30 seconds to load

java_options

 

 

 

A free life-saving Windows tool you never knew existed

Have you ever tried to find out the entire command line arguments for the ‘java’ command that starts your application in Windows ? Have you ever tried to find out which files or DLLs are opened by your Java Application in Windows ? The Windows Task Manager is OK but it does not give you the deeper insight that you would need to answer the above questions. Welcome to Process Explorer.

Read More

5 things you need to know about Java8, NOW !

Oracle’s latest edition of the world’s biggest software platform, Java 8 was released on March 2014. Here are the 5 things you need to know about this edition of this marvelous language.

1. Introduction of Lambda Expressions.

Read More

Top 10 reasons why your Enterprise Java Application is slow

Let’s face it. Nobody likes a slow application. It is our job to make sure our applications  fulfill the functionality need completely, but at the same time delivers good user experience.

In 16 years of my experience in technical support primarily in the world of JEE, while I cannot honestly say ‘I have seen it all’, I can say “I have seen a lot“. Here are the top 10 reasons why your Java application may slow.

Read More

One important change in Memory Management in Java 8

Oracle’s latest edition for Java – Java 8 was released in March 2014. As usual, tons of new features have been added. There is one major change in the Memory management area that I want to discuss today.

“So long PermGen, Hello Metaspace !!”

Oracle has completely gotten rid of ‘PermGen’ and replaced it with Metaspace.

What is PermGen ?

Read More