Posts

Showing posts from April, 2013

Push Notifications

Image
A notification in a message you can display to the user outside of your application's normal UI. When you tell the system to issue a notification, it first appears as an icon in the  notification area . To see the details of the notification, the user opens the  notification drawer . Both the notification area and the notification drawer are system-controlled areas that the user can view at any time. System will also display the notification as a TOAST when user is logged-in along with increment in the notification drawer. Lightweight Event Driven Notification System 1.1      Event Generation The event generation phase happens while processing the response to a user request. As such, we wanted to ensure that there was little or no impact on the response times from where notification is called/generated. To ensure this was the case, all we will do is store the minimum amount of data possible/lightweight message on the queue. We store the min...

Heap Dump Analysis

Image
When I got an OOM (out of memory) error, I had to try and understand what was going on inside the JVM. The best way to do that is a heap dump. The general idea is to dump out the contents of the JVM’s memory into a file, then analyse it using a tool.  An OOM simply means that the JVM ran out of memory. When this occurs, we basically have 2 choices: Allow the JVM to use more memory i.e. increase the –Xmx. But the question is till what extent? Improve/Fix the application so that it uses less memory. A memory leak happens when the application keeps more and more references to objects and never releases them. The garbage collector will therefore never collect those objects. At this point, the JVM will throw an OOM. To solve this issue, we first need to find the root cause of it. Java has a built-in feature for dumping heap snapshots called HeapDump. What is a heap dump? A heap dump is the dump of the heap. It will allow us to navigate the heap and see what objects u...

Understanding OutOfMemory Issues

Image
One of the most common problems that beset enterprise applications is the dreaded OutOfMemoryError. The error is typically followed by one of the following: Either you application server crashes. Or you have severe performance bottleneck.   A stuck thread waiting on resources leading nowhere and ultimately crashing the server. Regardless of the symptoms, you will most likely need to reboot the application server to make think ok. Causes of out-of-memory errors Before you attempt to resolve an out-of-memory error, first understanding how it can occur is beneficial. If the JVM runs out of memory anywhere in its process memory space, including all regions in the heap as well as the permanent memory space, and a process attempts to create a new object instance, the garbage collector executes to try to free enough memory to allow the new object's creation. If the garbage collector cannot free enough memory to hold the new object, then it throws an OutOfMemoryErro...