? as mentioned in title,i will make ?analytics between two tomcats which both running a solr app.
?
1.cases comparison
2.analytics
?
1.cases comparison
tomcat | Xms | Xmx | Xmn | NewRatio |
SurvivorRatio |
mem used by checking ‘top-RES‘ item |
resulted: actual new size |
A | 6g | 8g | 1.5g | - | 6 | 4.1g | 1.5g |
B | 20g | 20g | - | 4 | 6 | 4.9g | 4g |
? | ? | ? | ? | ? | ? | ? | ? |
?these are the jvm allocation by checking ‘jmap -heap pid‘
?tomcat A
Heap Configuration: MinHeapFreeRatio = 40 MaxHeapFreeRatio = 70 MaxHeapSize = 8589934592 (8192.0MB) NewSize = 1572864000 (1500.0MB) MaxNewSize = 1572864000 (1500.0MB) OldSize = 5439488 (5.1875MB) NewRatio = 4 SurvivorRatio = 6 PermSize = 67108864 (64.0MB) MaxPermSize = 104857600 (100.0MB) Heap Usage: New Generation (Eden + 1 Survivor Space): capacity = 1376256000 (1312.5MB) used = 782190664 (745.9551467895508MB) free = 594065336 (566.5448532104492MB) 56.83467785063244% used Eden Space: capacity = 1179648000 (1125.0MB) used = 738672576 (704.4530639648438MB) free = 440975424 (420.54693603515625MB) 62.61805013020833% used From Space: capacity = 196608000 (187.5MB) used = 43518088 (41.50208282470703MB) free = 153089912 (145.99791717529297MB) 22.134444173177084% used To Space: capacity = 196608000 (187.5MB) used = 0 (0.0MB) free = 196608000 (187.5MB) 0.0% used concurrent mark-sweep generation: capacity = 4869586944 (4644.0MB) used = 2786356080 (2657.2762298583984MB) free = 2083230864 (1986.7237701416016MB) 57.2195570598277% used Perm Generation: capacity = 67108864 (64.0MB) used = 37844912 (36.09172058105469MB) free = 29263952 (27.908279418945312MB) 56.39331340789795% used
?
?tomcat B
Heap Configuration: MinHeapFreeRatio = 40 MaxHeapFreeRatio = 70 MaxHeapSize = 21474836480 (20480.0MB) NewSize = 1310720 (1.25MB) MaxNewSize = 17592186044415 MB OldSize = 5439488 (5.1875MB) NewRatio = 4 SurvivorRatio = 6 PermSize = 67108864 (64.0MB) MaxPermSize = 104857600 (100.0MB) Heap Usage: New Generation (Eden + 1 Survivor Space): capacity = 3758096384 (3584.0MB) used = 1372982952 (1309.3785781860352MB) free = 2385113432 (2274.621421813965MB) 36.53400050742285% used Eden Space: capacity = 3221225472 (3072.0MB) used = 1277111448 (1217.948387145996MB) free = 1944114024 (1854.051612854004MB) 39.646757394075394% used From Space: capacity = 536870912 (512.0MB) used = 95871504 (91.43019104003906MB) free = 440999408 (420.56980895996094MB) 17.85745918750763% used To Space: capacity = 536870912 (512.0MB) used = 0 (0.0MB) free = 536870912 (512.0MB) 0.0% used concurrent mark-sweep generation: capacity = 17179869184 (16384.0MB) used = 1514222648 (1444.0752487182617MB) free = 15665646536 (14939.924751281738MB) 8.813935844227672% used Perm Generation: capacity = 67108864 (64.0MB) used = 37938264 (36.180747985839844MB) free = 29170600 (27.819252014160156MB) 56.532418727874756% used
?
2.analytics
? A.from all of info above,we know that :
RES~new gen-size + one survivor-size+ old gen‘s used-size + perm used= new eden + 2* survivor + old gen‘s used + perm used
? ?so the above tomcat A‘s RES = 4.1g ~?1312.5MB +?187.5MB + 2657mb + 36mb= 4193mb?
? ?that means the total mem used is always couted by base part say ‘new size‘ ,added by actual used old size and used perm size.in fact it‘s reasonable.
? B.the Xmx is the large size of the heap ,so jvm does not always reach it,but what about Xms?is it the min pre-allocated size guaranteed by jvm ?
? nope,we know,the RES is far less than it.
? C.jvm misc gen allcotion for mem.the tomcat B ‘s ‘actual new size‘ is 4g >> 1.5g which tomcat A used,but u will find that the actual used mem size is less than the A.
? A current used mem:704+41+2657 ~2.4g
? B ‘s one:1217+91 +1444 ~ 2.7g
? ?that means 2.7-2.4=300mb objects have been destroyed in ‘new area‘;
? ?and the old size used:A/2657 ~ 2 * B/1444, that means the Tomcat A jvm will first come into CMS compared to B;and of course,the A ‘s new-collection-time is much less than B,about half of time saved,say ~25ms .
?
?
原文:http://leibnitz.iteye.com/blog/2227489