Optimizing the Capacity of a HashMap

This article discusses how to optimize memory allocation in HashMaps by understanding the differences between allocation and mapping capacity. It emphasizes the importance of choosing the correct initial capacity, ideally a power of two, to mitigate space overhead and prevent performance degradation. Several formulas for calculating proper capacity are reviewed.

Actions on OutOfMemoryErrors

OutOfMemoryErrors in applications occur when memory allocation fails. This article discusses effective practices for analyzing such errors, including automatic heap dumps and using JVM parameters. It highlights script usage for automatic actions upon encountering errors and emphasizes the importance of proactive monitoring and automated incident reporting to reduce application downtime.

Chaos Engineering – DB Connection Leak

All modern applications connect with storage, such as a database or cache. Database connection leak is commonly observed in modern applications, which can result in connection leaks that can lead to production outages. In our series of chaos engineering articles, we have been learning how to simulate various performance problems. In this post, let's discuss... Continue Reading →

Chaos Engineering – File Connection Leak

Many Java applications still use files for importing and exporting data. If the connections to these files are not properly managed, it can lead to a significant number of connections leaking, causing the application to slow down or even crash. In our series of chaos engineering articles, we have been learning how to simulate various... Continue Reading →

Troubleshooting App unresponsiveness due to Oracle DB

The application experienced a slowdown when connecting to Oracle RAC due to resource constraints, impacting response times. Troubleshooting involved using the yCrash script for artifact collection and analysis, revealing that 46% of threads were blocking on database calls. The Oracle DBA confirmed resource issues, which, once resolved, restored normal application performance.

Troubleshooting deadlock in an Apache opensource library

Apache PDFBox is a Java library for handling PDF documents. A recent deadlock issue was identified, blocking two threads that were waiting for each other's resources. Troubleshooting involved capturing thread dumps and analyzing them, which led to filing a bug report with the Apache PDFBox team, who promptly addressed the issue.

Chaos Engineering – Metaspace OutOfMemoryError

JVM memory consists of various regions, including Young Generation, Old Generation, and Metaspace. 'java.lang.OutOfMemoryError: Metaspace' occurs when the Metaspace is full due to excessive metadata from dynamically created classes. Solutions include increasing Metaspace size or troubleshooting memory leaks. A sample program demonstrates this memory issue.

Troubleshooting Microservice’s OutOfMemoryError: Metaspace

The post discusses a 'java.lang.OutOfMemoryError: Metaspace' issue encountered in a Microservice application. It highlights the significance of the Metaspace memory region, outlines steps for diagnosing the error using garbage collection logs, and identifies a memory leak caused by an outdated third-party library. Upgrading the library resolved the issue.

Memory leak due to improper exception handling

The post discusses a memory leak problem encountered in a Java application running on AWS. After initial unresponsiveness, the yCrash tool identified the leak stemmed from an anonymous inner class. The issue was resolved by moving the 'pm.stopReporting()' method into a 'finally' clause, ensuring proper cleanup and garbage collection.

OutOfMemoryError: Kill process or sacrifice child – causes & solutions

The 'Kill Process or sacrifice child' OutOfMemoryError occurs when memory usage exceeds available RAM, prompting the OS to terminate certain processes. A simulation using an AWS EC2 instance demonstrated this error, where a Java application and a chaotic BuggyApp exceeded memory limits. Potential solutions include increasing RAM, reducing processes, and optimizing memory use.

Up ↑