They Do It With Mirrors – Java Process Memory in Microservices environment
summary
Production microservices randomly die because Linux OOM killer reaps Java processes after Java 8’s metaspace consumes native RAM; fat Spring Boot jars and shared libraries amplify RSS. Investigation uses top, free, jconsole, jstat, jcmd/jmap and Eclipse MAT heap dumps and Native Memory Tracking to find library-induced preloaded instances. Fixes: prune dependencies, convert shared fat jars to slim modules, set Xmx/Xms and -XX:MaxMetaspaceSize, and redeploy; result is metaspace reduction from gigabytes to megabytes and stable processes.
AI-written summary · about
chapters (40)
- 0:00Introduction
- 0:53Microservices benefits
- 2:03Microservices complexity
- 2:52Memory
- 4:24Basics
- 4:47Native Memory
- 6:20Resident Memory
- 6:53Virtual Size Memory
- 8:25Java 8 Memory
- 8:41Demo
- 9:10Setting the scene
- 10:25The second motion
- 11:32What do we know
- 12:01Out of Memory Killer
- 14:10Container Memory Limits
- 15:32Memory Management
- 17:02Microservices Size
- 18:51Lessons Learned
- 19:08Clarification Jars
- 20:19Java 7 vs Java 8
- 20:55Metaspace
- 21:27Sample Order Service
- 21:56JVM Parameters
- 22:24Java 8 Meta Space Size
- 23:22Design and Implementation Decisions
- 25:34Resource Utilization
- 26:43Active Activity Monitor
- 27:03JConsole
- 27:21JVM Instrumentation
- 28:22GCUtil Allocation
- 28:38JCMD
- 28:59Heap Dump
- 29:38Leak Suspect Report
- 31:05Free Top
- 31:33Native Memory Tracking
- 32:16Cost Implications
- 33:28Memory Footprint
- 33:48Key takeaways
- 34:52A couplet
- 35:49Meta space
