Investigating Unexpected Swap Usage in a Java Service on an 8 GB Server

Despite allocating a 6 GB heap to a Java service on an 8 GB server—leaving roughly 1.4 GB for the OS and monitoring—the system still swaps heavily, because the kernel’s non‑heap memory, page cache, and overcommit handling consume the remaining RAM, causing GC pauses and severe JVM stalls.

Meituan Technology Team
Meituan Technology Team
Meituan Technology Team
Investigating Unexpected Swap Usage in a Java Service on an 8 GB Server

On servers equipped with 8 GB of physical memory, a Java service is configured with a 6 GB JVM heap, while a monitoring process consumes roughly 600 MB and the Linux operating system itself uses about 800 MB. Superficially, the memory allocation appears sufficient for the workload.

In practice, however, the system experiences extensive swap usage, as illustrated in the accompanying screenshot. The simultaneous occurrence of swap activity and garbage collection (GC) leads to severe JVM stalls, prompting the question: where is the memory actually going?

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

JavaJVMperformanceMemory ManagementSwap
Meituan Technology Team
Written by

Meituan Technology Team

Over 10,000 engineers powering China’s leading lifestyle services e‑commerce platform. Supporting hundreds of millions of consumers, millions of merchants across 2,000+ industries. This is the public channel for the tech teams behind Meituan, Dianping, Meituan Waimai, Meituan Select, and related services.

0 followers
Reader feedback

How this landed with the community

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.