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.
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?
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
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.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
