Backend Development 8 min read

Diagnosing High Memory Usage in Spring Boot Applications and Tuning JVM Parameters

This article details a real‑world case where Spring Boot microservices on a 64 GB server consumed excessive memory, explains how to diagnose the issue using jps and jmap, discusses default JVM heap settings, and provides practical recommendations for tuning JVM parameters to prevent similar problems.

Top Architect
Top Architect
Top Architect
Diagnosing High Memory Usage in Spring Boot Applications and Tuning JVM Parameters

In production we observed that each Spring Boot microservice on a 64 GB server was using about 12 GB of memory, causing the applications to become unresponsive.

To reproduce the issue locally we simulated similar conditions and captured memory usage screenshots.

Background : The high memory consumption was due to default JVM heap settings when no explicit parameters were provided.

Solution steps :

Use jps to list Java processes and obtain the process ID, or use top .

Run jmap -heap <pid> to view heap configuration; we found the maximum heap size was set to 4 GB while the physical memory was 64 GB.

The default JVM parameters typically allocate a maximum heap size of one‑quarter of physical memory ( -Xmx ) and an initial heap size of one‑sixty‑fourth ( -Xms ), which can lead to excessive memory usage on servers.

We reviewed Oracle’s official defaults, noting differences between client and server JVMs and between 32‑bit and 64‑bit environments.

Recap :

Check and adjust JVM parameters to match application needs and server capacity.

Monitor memory usage with tools such as VisualVM or MAT.

Analyze GC logs and set appropriate heap sizes.

Consider using memory analysis tools to detect leaks or large objects.

Failing to set proper JVM options can cause high memory consumption, performance degradation, and resource waste in production.

Additionally, the article includes promotional information about a ChatGPT community, paid courses, and related offers.

JavaJVMSpringBootMemoryOptimizationBackendDevelopment
Top Architect
Written by

Top Architect

Top Architect focuses on sharing practical architecture knowledge, covering enterprise, system, website, large‑scale distributed, and high‑availability architectures, plus architecture adjustments using internet technologies. We welcome idea‑driven, sharing‑oriented architects to exchange and learn together.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.