Search

GC easy – Universal Java GC Log Analyser

Month

August 2022

Chaos Engineering – Metaspace OutOfMemoryError

The JVM memory consists of several regions, including the Metaspace, which stores metadata for classes and methods. An 'OutOfMemoryError: Metaspace' indicates that this area is saturated. This article discusses how to simulate this error and addresses its causes, including inadequate Metaspace allocation and memory leaks.

How a Top 5 Car Manufacturer Slashed App Response Time by 50%

A leading automobile manufacturer enhanced their middleware platform's response time by 49.46% through optimizing garbage collection with the GCeasy tool, reducing average response time from 1.88 seconds to 0.95 seconds. This adjustment, achieved without code modifications, also decreased transactions exceeding 25 seconds from 0.7% to 0.31%.

Inspect the contents of the Java Metaspace region

The post outlines the regions of JVM memory, focusing on the Metaspace, which contains class metadata. It offers five methods to inspect loaded classes: using verbose flags for versions 8 and 9+, invoking jcmd, a programmatic approach, and performing Heap Dump analysis. Each method is described for practical usage.

Java String intern(): Performance impact

The java.lang.String#intern() method can significantly reduce memory usage by eliminating duplicate strings in Java applications. A comparison of two programs—one utilizing intern() and the other not—demonstrated that the intern() method reduced memory consumption from 1.08GB to 38.37MB at the cost of increased response time.

Java String intern(): Interesting Q & A

The intern() function in Java's String class optimizes memory usage by managing a pool of string objects in the JVM. When invoked, it checks for existing strings, reusing them if present to eliminate duplicates. While beneficial for memory efficiency, using intern() can negatively impact application response time compared to other methods like string deduplication.

Garbage Collection CPU Statistics

Garbage Collection events predominantly occur in the Java application layer, termed 'User' time, where the Garbage Collector identifies and marks active objects and evicts unreferenced ones. 'Sys' time represents the time spent in the Operating System/Kernel for memory allocation, deallocation, and disk I/O activities. Overall 'CPU' time combines both 'User' and 'Sys' time.

In which region intern strings are stored?

The intern() function in Java's String class helps eliminate duplicate string objects, reducing memory usage by storing interned strings in the JVM's heap region. This post includes practical examples, performance observations from a sample program, and highlights the significance of enabling garbage collection logging for memory management insights.

Up ↑