Apr
12th
Mon
12th
Java GC Basics
Basic notes on Java garbage collection that every system engineer dealing with Java in production should know.
- Always run with gc logging enabled.
- Watch for promotion failures in the gc log. If you are have any, the heap is fragmented, restart the process.
- GC time seems to be proportional to size of the heap. GC’s will be slow with a 10GB heap size.
- The CMS collector has better concurrency, but it is VERY slow. To use it your application may have to do a lot of manual object pooling.
- 10% or 20% of time spent in GC is reasonable. 50% is not. 99% means you are out of memory.
- Be sure to use -server so that multiple cores are used for Full GC’s.
- -Xmx is the really important parameter. -Xms not so much.