Memory Leak Due To Improper Exception Handling

In this post, let’s discuss an interesting memory problem we confronted in the production environment and how we went about solving it. This application would take traffic for a few hours after that it would become unresponsive. It wasn’t clear what was causing the unresponsiveness in the application.

Technology Stack

This application was running on AWS cloud in r5a.2xlarge EC2 instances. It was a Java application running on an Apache Tomcat server using the Spring framework. It was also using other AWS services like S3 and Elastic Beanstalk. This application had a large heap size (i.e. -Xmx): 48GB.

Garbage Collection Tuning Success Story: Reducing Young Gen Size

When you tune Garbage collection performance, you are not only improving Garbage collection pause time but also the overall application’s response time and reducing cloud computing cost. Recently, we helped to tune the Garbage collection behavior of a popular application. Just by making a minor change, it resulted in a dramatic improvement. Let’s discuss this garbage collection tuning success story in this post.

Garbage Collection KPIs

There is a famous saying that "you can’t optimize something that you can’t measure." When it comes to garbage collection tuning, there are only 3 primary Key Performance Indicators (KPIs) that you should be focusing upon:

How To Do GC Log Analysis?

Analyzing garbage collection logs provides several advantages like it reduces GC pause time, reduces cloud computing cost, predicts outages, provides effective metrics for capacity planning. To learn about the profound advantages of GC log analysis, please refer to this post. In this post let’s learn how to analyze GC logs?

Basically, there are 3 essential steps when it comes to GC log analysis:

Spring Boot Pet Clinic App: A Performance Study

Spring pet clinic application is a sample application developed by the Spring Framework developers to demonstrate the capabilities of Spring Boot, Spring MVC, and Spring Data Framework. We set out to conduct a performance test on this application and see whether we can identify any performance bottlenecks.

Environment Setup

We cloned the Spring pet clinic application’s official Github repository and followed instructions to build a JAR file. Once the JAR file was ready, we launched the application on http://localhost:8080.

How Many Millions of Dollars Do Enterprises Waste Due to Garbage Collection?

We truly believe enterprises are wasting millions of dollars in garbage collection. We equally believe enterprises are wasting these many millions of dollars even without knowing they are wasting. The intent of this post is to bring visibility to how several millions of dollars are wasted due to garbage collection.

What is Garbage?

All applications have a finite amount of memory. When a new request comes, the application creates objects to service the request. Once a request is processed, all the objects created to service that request are no longer needed. In other terms those objects become garbage. They have to be evicted/removed from the memory so that room is created to service new incoming requests.

Java Memory Management

You might think that if you are programming in Java, what do you need to know about how memory works? Java has automatic memory management, a nice and quiet garbage collector that works in the background to clean up the unused objects and free up some memory.

Therefore, you as a Java programmer do not need to bother yourself with problems like destroying objects, as they are not used anymore. However, even if this process is automatic in Java, it does not guarantee anything. By not knowing how the garbage collector and Java memory is designed, you could have objects that are not eligible for garbage collecting, even if you are no longer using them.

Best Practices: Java Memory Arguments for Containers

When running your Java application in physical servers, you would have been using ‘-Xmx’ JVM argument to specify the Java heap size. If you are porting your application to Containers, you might be wondering how to configure Java heap size in the container’s world? Are there any best practices? In this article, we will discuss the possible JVM arguments that can be used to specify the Java heap size and the best option to choose. 

There are 3 different options to specify the maximum Java heap size in containers. They are:

What Are Garbage Collection Logs, Thread Dumps, and Heap Dumps?

Java Virtual Machine (JVM) generates 3 critical artifacts that are useful for optimizing the performance and troubleshooting production problems. Those artifacts are:

  1. Garbage collection (GC) log
  2. Thread Dump
  3. Heap Dump

In this article, let's try to understand these 3 critical artifacts, where to use them, how do they look, how to capture them, how to analyze them, and their differences.

Understanding Types of References in Java

Learn more about the different types of references in Java.

There are four types of references in Java. And for each of them, the garbage collector behaves a little bit differently.

Below, I will try to explain each type of reference's characteristics and possible use cases, specifically strongweaksoft, and phantom references.