国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開APP
userphoto
未登錄

開通VIP,暢享免費(fèi)電子書等14項(xiàng)超值服

開通VIP
使用Docker容器時(shí)需要更改GC并發(fā)參數(shù)配置京東線上我們線上某服務(wù)的JVM參數(shù)
使用Docker容器時(shí)需要更改GC并發(fā)參數(shù)配置
博客分類: 架構(gòu)
最近在做統(tǒng)一服務(wù)優(yōu)化時(shí)發(fā)現(xiàn)使用容器時(shí)垃圾回收偏長,而我們的服務(wù)是一個(gè)響應(yīng)時(shí)間優(yōu)先的應(yīng)用,需要對(duì)GC進(jìn)行一些調(diào)優(yōu),在對(duì)容器內(nèi)Java應(yīng)用進(jìn)行GC時(shí)發(fā)現(xiàn):
(8核)如下是8核機(jī)器的GC,CMS,young gc基本在100ms左右
[GC (Allocation Failure) 1540815K->708720K(1992320K), 0.1204106 secs]
[GC (Allocation Failure) 1547632K->718037K(1992320K), 0.1039874 secs]
[GC (Allocation Failure) 1568245K->734990K(1992320K), 0.0979778 secs]
[GC (Allocation Failure) 1573902K->739338K(1992320K), 0.1270793 secs]
[GC (Allocation Failure) 1578250K->743388K(1992320K), 0.1074495 secs]
[GC (Allocation Failure) 1582300K->749564K(1992320K), 0.1199881 secs]
[GC (Allocation Failure) 1588476K->752993K(1992320K), 0.1134528 secs]
[GC (Allocation Failure) 1591905K->761514K(1992320K), 0.1208703 secs]
[GC (Allocation Failure) 1600426K->762095K(1992320K), 0.1214570 secs]
[GC (Allocation Failure) 1601007K->764275K(1992320K), 0.1035069 secs]
[GC (CMS Initial Mark) 775325K(1992320K), 0.0122687 secs]
[GC (CMS Final Remark) 1174093K(1992320K), 0.2219463 secs]
[GC (Allocation Failure) 1075577K->241414K(1992320K), 0.0959227 secs]
[GC (Allocation Failure) 1080326K->246942K(1992320K), 0.1073993 secs]
(8核)經(jīng)發(fā)現(xiàn)與GC線程有關(guān),通過指定并發(fā)GC線程數(shù) -XX:ParallelGCThreads=8 -XX:ConcGCThreads=4,得到
[GC (Allocation Failure) 1631622K->798323K(1992320K), 0.0408915 secs]
[GC (Allocation Failure) 1637235K->797560K(1992320K), 0.0423643 secs]
[GC (Allocation Failure) 1636472K->803864K(1992320K), 0.0422181 secs]
[GC (Allocation Failure) 1642776K->813965K(1992320K), 0.0429882 secs]
[GC (Allocation Failure) 1686836K->850230K(1992320K), 0.0521587 secs]
[GC (Allocation Failure) 1689142K->858658K(1992320K), 0.0496138 secs]
[GC (Allocation Failure) 1697570K->858148K(1992320K), 0.0439780 secs]
[GC (Allocation Failure) 1697059K->865706K(1992320K), 0.0517013 secs]
[GC (CMS Initial Mark) 865828K(1992320K), 0.0184015 secs]
[GC (CMS Final Remark) 1198017K(1992320K), 0.1831652 secs]
[GC (Allocation Failure) 1132594K->301826K(1992320K), 0.0444428 secs]
[GC (Allocation Failure) 1140738K->305794K(1992320K), 0.0428419 secs]
[GC (Allocation Failure) 1144679K->312688K(1992320K), 0.0545760 secs]
[GC (Allocation Failure) 1151600K->320109K(1992320K), 0.0410423 secs]
[GC (Allocation Failure) 1159021K->320191K(1992320K), 0.0411587 secs]
[GC (Allocation Failure) 1159103K->330729K(1992320K), 0.0387938 secs]
[GC (Allocation Failure) 1169641K->331256K(1992320K), 0.0393934 secs]
[GC (Allocation Failure) 1170163K->343068K(1992320K), 0.0419092 secs]
(16核)而下邊是-XX:ParallelGCThreads=16 -XX:ConcGCThreads=8
[GC (Allocation Failure) 1551548K->713703K(1992320K), 0.0400264 secs]
[GC (Allocation Failure) 1552615K->716536K(1992320K), 0.0463409 secs]
[GC (Allocation Failure) 1555448K->723921K(1992320K), 0.0313725 secs]
[GC (Allocation Failure) 1562833K->728720K(1992320K), 0.0333375 secs]
[GC (Allocation Failure) 1567629K->734094K(1992320K), 0.0352418 secs]
[GC (Allocation Failure) 1573006K->739880K(1992320K), 0.0368524 secs]
[GC (Allocation Failure) 1578792K->741607K(1992320K), 0.0418331 secs]
[GC (Allocation Failure) 1580519K->749161K(1992320K), 0.0379511 secs]
[GC (Allocation Failure) 1588073K->755358K(1992320K), 0.0347147 secs]
[GC (Allocation Failure) 1594270K->761399K(1992320K), 0.0379215 secs]
[GC (Allocation Failure) 1600311K->765948K(1992320K), 0.0348537 secs]
[GC (Allocation Failure) 1604858K->774675K(1992320K), 0.0371332 secs]
[GC (CMS Initial Mark) 774724K(1992320K), 0.0120999 secs]
[GC (CMS Final Remark) 1067302K(1992320K), 0.1657415 secs]
[GC (Allocation Failure) 1130442K->286546K(1992320K), 0.0299338 secs]
[GC (Allocation Failure) 1125458K->298132K(1992320K), 0.0328611 secs]
[GC (Allocation Failure) 1137044K->304370K(1992320K), 0.0357785 secs]
(8核)而如果換成UseParallelGC,young gc不錯(cuò),而full gc偏慢,線上如果沒有配置CMS的話,默認(rèn)是用這個(gè)
[GC (Allocation Failure) 1993894K->1000058K(2072576K), 0.0396914 secs]
[GC (Allocation Failure) 1999482K->1007021K(2072576K), 0.0403703 secs]
[GC (Allocation Failure) 2006445K->1011597K(2068480K), 0.0432666 secs]
[GC (Allocation Failure) 2006925K->1016275K(2070528K), 0.0450037 secs]
[GC (Allocation Failure) 2011603K->1020929K(2070528K), 0.0490808 secs]
[GC (Allocation Failure) 2016257K->1025389K(2070528K), 0.0395652 secs]
[GC (Allocation Failure) 2020717K->1029915K(2070528K), 0.0415800 secs]
[GC (Allocation Failure) 2025243K->1035623K(2070528K), 0.0534249 secs]
[GC (Allocation Failure) 2030951K->1041520K(2072576K), 0.0473277 secs]
[GC (Allocation Failure) 2040944K->1046783K(2072576K), 0.0447377 secs]
[GC (Allocation Failure) 2046207K->1052829K(2068480K), 0.0466185 secs]
[GC (Allocation Failure) 2048157K->1057749K(2070528K), 0.0435571 secs]
[GC (Allocation Failure) 2053077K->1063253K(2070528K), 0.0434343 secs]
[GC (Allocation Failure) 2058581K->1067759K(2070528K), 0.0402552 secs]
[Full GC (Ergonomics) 1067759K->235608K(2070528K), 0.4808497 secs]
[GC (Allocation Failure) 1230936K->247560K(2070528K), 0.0318850 secs]
[GC (Allocation Failure) 1242888K->254827K(2070528K), 0.0340009 secs]
[GC (Allocation Failure) 1250155K->259247K(2066432K), 0.0337921 secs]
[GC (Allocation Failure) 1250479K->264965K(2068480K), 0.0585058 secs]
雖然GC不如物理機(jī),但是可以滿足我們的需要了。
注:
1、因?yàn)槿萜鞑皇俏锢砀綦x的,比如使用Runtime.getRuntime().availableProcessors() ,會(huì)拿到物理CPU個(gè)數(shù),而不是容器申請(qǐng)時(shí)的個(gè)數(shù),
2、CMS在算GC線程時(shí)默認(rèn)是根據(jù)物理CPU算的:(http://mail.openjdk.java.net/pipermail/hotspot-gc-dev/2013-November/008952.html )
年輕代的并行線程數(shù)(ParallelGCThreads):
Java代碼 
return (ncpus <= 8) ? ncpus : MAX2(8, ncpus / 2)
CMS并行線程數(shù)(ConcGCThreads):
Java代碼 
if (AdjustGCThreadsToCores) {
FLAG_SET_DEFAULT(ConcGCThreads, ParallelGCThreads / 2);
} else {
FLAG_SET_DEFAULT(ConcGCThreads, (3 + ParallelGCThreads) / 4);
}
因?yàn)槲覀兩?jí)到了JDK8/Tomcat8, 遇到以下問題:
1、Tomcat8使用Nio2時(shí)有時(shí)候會(huì)遇到如下警告,暫時(shí)沒有升級(jí)上去
org.apache.tomcat.util.net.AbstractEndpoint countDownConnection
WARNING: Incorrect connection count, multiple socket.close called on the same socket.
2、使用G1垃圾回收時(shí),在我們的小堆上沒有多大優(yōu)勢(shì),暫時(shí)沒有使用。
我們線上某服務(wù)的JVM參數(shù)
export JAVA_OPTS="-Djava.library.path=/usr/local/lib -server -XX:ReservedCodeCacheSize=64m -XX:TLABWasteTargetPercent=10 -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+ParallelRefProcEnabled -XX:+CMSClassUnloadingEnabled -XX:CMSInitiatingOccupancyFraction=70 -XX:+UseCMSInitiatingOccupancyOnly -XX:+UnlockDiagnosticVMOptions -XX:ParallelGCThreads=8 -XX:ConcGCThreads=4 -Xss256k -server -Xms2g -Xmx2g -XX:MaxDirectMemorySize=256m -XX:MaxTenuringThreshold=3 -XX:NewRatio=1 -XX:SurvivorRatio=8 -XX:+UnlockDiagnosticVMOptions -XX:ParGCCardsPerStrideChunk=32768 -XX:+AlwaysPreTouch
本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊舉報(bào)。
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
第20課:JVM中CMS收集器解密
JVM調(diào)優(yōu)常用參數(shù)
Tomcat
[轉(zhuǎn)帖]Jvm Tuning-feidi -JavaEye技術(shù)社區(qū)
JVM優(yōu)化配置(轉(zhuǎn))
JVM調(diào)優(yōu)總結(jié)(七)-典型配置舉例1
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長圖 關(guān)注 下載文章
綁定賬號(hào)成功
后續(xù)可登錄賬號(hào)暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服