Setting -Xms -Xmx JVM settings

It can be important in some circumstances to set your heap size. What size that is is another article here: https://support.lucidworks.com/hc/en-us/articles/201298327-Estimating-your-heap-and-memory-requirements

 

But let's see what happens to a garbage collector that starts having fits trying to resize the total heap:

This is minor gc's of the eden space while everything is in homeostasis:

1425.426: [GC1425.427: [ParNew: 1762648K->70069K(1887488K), 0.0885440 secs] 3986972K->2315705K(8178944K), 0.0888010 secs] [Times: user=0.99 sys=0.03, real=0.09 secs]
1429.483: [GC1429.483: [ParNew: 1747893K->81444K(1887488K), 0.0787310 secs] 3993529K->2332910K(8178944K), 0.0790780 secs] [Times: user=0.93 sys=0.00, real=0.07 secs]
1433.452: [GC1433.452: [ParNew: 1759268K->73502K(1887488K), 0.0760620 secs] 4010734K->2330335K(8178944K), 0.0763780 secs] [Times: user=0.91 sys=0.00, real=0.08 secs]
1436.955: [GC1436.955: [ParNew: 1751326K->82672K(1887488K), 0.0648200 secs] 4008159K->2345874K(8178944K), 0.0651440 secs] [Times: user=0.77 sys=0.01, real=0.06 secs]
1440.327: [GC1440.327: [ParNew: 1760496K->74283K(1887488K), 0.0588960 secs] 4023698K->2343494K(8178944K), 0.0592400 secs] [Times: user=0.69 sys=0.01, real=0.06 secs]
1443.837: [GC1443.837: [ParNew: 1752107K->74751K(1887488K), 0.0727440 secs] 4021318K->2350398K(8178944K), 0.0730800 secs] [Times: user=0.86 sys=0.01, real=0.07 secs]
1447.661: [GC1447.661: [ParNew: 1752575K->67703K(1887488K), 0.0562160 secs] 4028222K->2350357K(8178944K), 0.0565800 secs] [Times: user=0.64 sys=0.00, real=0.06 secs]
1451.781: [GC1451.781: [ParNew: 1745527K->72787K(1887488K), 0.0723320 secs] 4028181K->2361524K(8178944K), 0.0726720 secs] [Times: user=0.86 sys=0.00, real=0.07 secs]
1454.662: [GC1454.662: [ParNew: 1750611K->64176K(1887488K), 0.0480380 secs] 4039348K->2358768K(8178944K), 0.0483590 secs] [Times: user=0.55 sys=0.01, real=0.05 secs]

Note, everything looks good here. Notice that total heap (8178944K) stays the same. 

Now lets look as it goes wacky:

20481.292: [GC20481.292: [ParNew: 1741726K->209664K(1887488K), 0.7516550 secs] 5339516K->4171455K(8178944K), 0.7519580 secs] [Times: user=6.17 sys=0.37, real=0.75 secs]
20483.117: [GC20483.118: [ParNew: 1830416K->209664K(1887488K), 0.8316790 secs] 5792208K->4532409K(8286488K), 0.8319670 secs] [Times: user=8.11 sys=1.24, real=0.84 secs]
20484.410: [GC20484.410: [ParNew: 1877268K->209395K(1887488K), 1.2351070 secs] 6200013K->4939339K(8651792K), 1.2353990 secs] [Times: user=1.21 sys=2.20, real=1.23 secs]
20485.667: [GC [1 CMS-initial-mark: 4729944K(6764304K)] 5080716K(8651792K), 0.0651180 secs] [Times: user=0.06 sys=0.00, real=0.07 secs]
20485.732: [CMS-concurrent-mark-start]
20485.971: [GC20485.972: [ParNew: 1842615K->209664K(1887488K), 0.5009290 secs] 6572559K->5540199K(9241380K), 0.5012150 secs] [Times: user=4.89 sys=1.18, real=0.50 secs]
20486.750: [GC20486.750: [ParNew: 1878573K->203717K(1887488K), 1.2322300 secs] 7209108K->5991484K(9695068K), 1.2325740 secs] [Times: user=10.31 sys=4.61, real=1.23 secs]
20488.236: [GC20488.236: [ParNew: 1877335K->208833K(1887488K), 1.5838660 secs] 7665102K->6505947K(10199900K), 1.5840920 secs] [Times: user=4.87 sys=2.48, real=1.59 secs]
20490.109: [GC20490.109: [ParNew: 1865862K->209664K(1887488K), 0.1345800 secs] 8162976K->6867639K(10553032K), 0.1349090 secs] [Times: user=1.28 sys=0.39, real=0.14 secs]
20490.504: [GC20490.504: [ParNew: 1845574K->204899K(1887488K), 5.4339010 secs] 8503550K->7515871K(11193720K), 5.4342070 secs] [Times: user=5.08 sys=27.11, real=5.43 secs]
20496.166: [GC20496.166: [ParNew: 1836368K->186669K(1887488K), 2.5900110 secs] 9147340K->8101071K(11792916K), 2.5902510 secs] [Times: user=23.03 sys=9.55, real=2.59 secs]
20498.975: [GC20498.975: [ParNew: 1839467K->209653K(1887488K), 5.1865280 secs] 9753870K->8725160K(12388892K), 5.1867620 secs] [Times: user=15.12 sys=23.29, real=5.18 secs]
20504.391: [GC20504.391: [ParNew: 1876149K->208923K(1887488K), 3.6461680 secs] 10391657K->9324740K(12985320K), 3.6465180 secs] [Times: user=4.42 sys=19.76, real=3.65 secs]
20508.278: [GC20508.279: [ParNew: 1886747K->209426K(1887488K), 4.1629820 secs] 11002564K->9842905K(13498748K), 4.1633180 secs] [Times: user=31.94 sys=20.29, real=4.16 secs]
20512.687: [GC20512.687: [ParNew: 1874331K->209664K(1887488K), 5.1388800 secs] 11507810K->10326189K(13979732K), 5.1391810 secs] [Times: user=33.00 sys=31.20, real=5.14 secs]

Notice these are all minor gcs taking a long, long time while the JVM tries to reset how much memory it is grabbing. You can see the overall sizes keeps changing every time we do a minor gc. So when you finally figure out what the ideal memory size it... it can be a very good idea to set is as the one size with -Xms -Xmx being the same size. 

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.
Powered by Zendesk