resin之jvm优化「建议收藏」

2022-08-31 16:25:17 浏览数 (2)

大家好,又见面了,我是你们的朋友全栈君。

经过几天的测试,系统终于较以前有所稳定了,特把优化后的参数发布出来,供朋友们一起讨论

我的服务器配置:至强双CPU2.2G,ECC内存4G,硬盘70G,操作系统:AS4 jdk1.5.0_02

没优化之前,服务器经常抛出内存溢出,物理内存居高不下,还经常抛出keepalive 超过最大值500。服务器一天重启两三次,客户抱怨声不断。

<jvm-arg>-Xms1024M</jvm-arg> <jvm-arg>-Xmx1024M</jvm-arg> <jvm-arg>-Xmn256M</jvm-arg> <jvm-arg>-Xss1M</jvm-arg> <jvm-arg>-XX:PermSize=256M</jvm-arg> <jvm-arg>-XX:MaxPermSize=256M</jvm-arg> <jvm-arg>-XX:NewRatio=4</jvm-arg> <jvm-arg>-XX:SurvivorRatio=4</jvm-arg> <jvm-arg>-XX:MaxTenuringThreshold=7</jvm-arg> <jvm-arg>-XX:GCTimeRatio=10</jvm-arg> <jvm-arg>-XX: UseConcMarkSweepGC</jvm-arg> <jvm-arg>-XX: UseCMSCompactAtFullCollection</jvm-arg> <jvm-arg>-XX:CMSFullGCsBeforeCompaction=5</jvm-arg> <jvm-arg>-XX:CMSInitiatingOccupancyFraction=70</jvm-arg> <jvm-arg>-XX:SoftRefLRUPolicyMSPerMB=0</jvm-arg> <jvm-arg>-XX: PrintClassHistogram</jvm-arg> <jvm-arg>-XX: PrintGCDetails</jvm-arg> <jvm-arg>-XX: PrintGCTimeStamps</jvm-arg> <jvm-arg>-XX: PrintGCApplicationConcurrentTime</jvm-arg> <jvm-arg>-XX: PrintGCApplicationStoppedTime</jvm-arg> <jvm-arg>-Xloggc:log/gc.log</jvm-arg>

优化以后,已经稳定运行四天了,物理空闲内存大概1G左右,不知道以上设置还有没有不合理的地方,如果有,请指教。

经过一段时间,又做了如下改动

<jvm-arg>-server</jvm-arg> <jvm-arg>-Xms1524M</jvm-arg>

<jvm-arg>-Xmx1524M</jvm-arg>

<jvm-arg>-Xmn512M</jvm-arg> <jvm-arg>-Xss1M</jvm-arg>

<jvm-arg>-XX:PermSize=256M</jvm-arg>

<jvm-arg>-XX:MaxPermSize=256M</jvm-arg>

<jvm-arg>-XX:SurvivorRatio=8</jvm-arg>

<jvm-arg>-XX:MaxTenuringThreshold=7</jvm-arg>

<jvm-arg>-XX:GCTimeRatio=19</jvm-arg>

<jvm-arg>-XX: UseParNewGC</jvm-arg>

<jvm-arg>-XX: UseConcMarkSweepGC</jvm-arg> <jvm-arg>-XX: CMSPermGenSweepingEnabled</jvm-arg> <jvm-arg>-XX: CMSClassUnloadingEnabled</jvm-arg>

<jvm-arg>-XX: UseCMSCompactAtFullCollection</jvm-arg>

<jvm-arg>-XX:CMSFullGCsBeforeCompaction=2</jvm-arg> <jvm-arg>-XX:-CMSParallelRemarkEnabled</jvm-arg> <jvm-arg>-XX: DisableExplicitGC</jvm-arg>

<jvm-arg>-XX:CMSInitiatingOccupancyFraction=70</jvm-arg>

<jvm-arg>-XX:SoftRefLRUPolicyMSPerMB=0</jvm-arg>

<jvm-arg>-XX: PrintClassHistogram</jvm-arg>

<jvm-arg>-XX: PrintGCDetails</jvm-arg>

<jvm-arg>-XX: PrintGCTimeStamps</jvm-arg>

<jvm-arg>-XX: PrintGCApplicationConcurrentTime</jvm-arg>

<jvm-arg>-XX: PrintGCApplicationStoppedTime</jvm-arg>

<jvm-arg>-Xloggc:log/gc.log</jvm-arg>

resin已经换成resin-pro-3.1.8版本了,现在系统运行越来越稳定了,高兴!

发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/143088.html原文链接:https://javaforall.cn

0 人点赞