I have recently taken up task to benchmark and optimize memory utilization in our Java Servers, while fixing the memory leaks if any. We have 4 JVM servers running in a single machine which has 15G Physical memory and 32G Swap memory. Following is free -m snapshot.
total used free shared buff/cache available
Mem: 15289 14786 392 1 110 342
Swap: 32767 3776 28991
If I understand correctly:-
- Most of the physical memory is in use and most of the swap memory is free.
- A low of amount of memory is actually buffered.
- I have 48GB of virtual memory
Now each of my server is running with 7G Maximum heap size set with -Xmx option. Following is the output from GC Utils
$ jstat -gcutil 8317
S0 S1 E O M CCS YGC YGCT FGC FGCT GCT
0.00 0.00 6.97 0.22 96.77 91.89 72 8.027 33 10.975 19.002
$ jstat -gcutil 8332
S0 S1 E O M CCS YGC YGCT FGC FGCT GCT
0.00 0.00 5.17 50.76 96.57 91.65 274 51.001 51 179.106 230.107
$ jstat -gcutil 8249
S0 S1 E O M CCS YGC YGCT FGC FGCT GCT
0.00 2.10 80.37 69.53 96.87 92.08 421 69.478 13 56.569 126.047
$ jstat -gcutil 23875
S0 S1 E O M CCS YGC YGCT FGC FGCT GCT
27.91 0.00 37.07 86.29 97.59 94.60 232 7.294 2 0.030 7.324
After running manual Full GC, it completely freed young and old generation for all the servers. Now I need help in understanding this characterstic, basically am I correct in assuming following?
- Objects move depending on longevity and surviving count as Eden -> S0 -> S1 -> O.
- Three of the servers have Old Gen > Young Gen. Does that mean that the Full GC is not running enough?
- Or, I need to tweak SurvivorRatio and NewRatio etc. settings to give Young Generation more chance to collect objects, and delay moving the objects to old space.
- However increasing Y space means slower short GC and poor application throughput, Should I increase memory and stop worrying about tweaking?
I am asking this, because Full GC does free all memory, so there is no memory leak but How can I strike a balance between memory usage and application troughput by adjusting GC settings. Could anyone provide more direction or reccomendation by taking above machine state into consideration?
JVM Details:
Java Version: openjdk version "1.8.0_131" Server Class
GC: Parallel Collector(Default one)