免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2259 | 回复: 0

[WebLogic] weblogic 内存调优 [复制链接]

论坛徽章:
0
发表于 2011-12-19 14:02 |显示全部楼层
<DIV><FONT size=2>运行程序,提示 java.lang.OutOfMemoryError</FONT></DIV>
<DIV><FONT size=2>(1)在myeclipse里面进行调试时,调高内存通过下面方法</FONT></DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV>window-&gt; preferences-&gt; myeclipse-&gt; application server-&gt; Weblogic X -&gt; jdk-&gt; optional java jvm arguments里加 &nbsp; <BR>&nbsp;-Xms128m -Xmx512m</DIV>
<DIV>&nbsp;</DIV>
<DIV>(2)另外再转一个关于weblogic内存溢出的问答</DIV>
<DIV>&nbsp;</DIV>
<DIV>
<DIV class=codeText id=codeText>
<OL class=dp-css style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 5px; MARGIN: 0px 1px 0px 0px; PADDING-TOP: 5px">
<LI>最好不要自己写线程去GC,GC是JVM的工作,我们最好不要干涉它。</LI>
<LI></LI>
<LI>下面粘贴一段关于WebLogic out of memory问题的经典问答,连如何用profiling工具去解决这个问题,以及使用profiling工具的注意事项都提到了。</LI>
<LI></LI>
<LI>FAQ: OutOfMemory in WebLogic</LI>
<LI>From time to time I see questions like this:</LI>
<LI></LI>
<LI>Q: "We are seeing OutOfMemory error in the WebLogic log, after that our app becomes inaccessible. The application is not under heavy load. In fact, we can see it even if the server is idle. WebLogic performance console shows that there is plenty of heap available. What's wrong?".</LI>
<LI></LI>
<LI>A: Given the symptoms above, the most likely cause of the problem is that the default size of the heap allocated by JVM for long living objects is often too small for a J2EE application is general and for one under WebLogic in particular. Weblogic uses caching a lot, so if you've got many EJBs, there will be plenty of long living object, and they may not fit into perm heap.</LI>
<LI></LI>
<LI>To fix this problem, you need to increase MaxPermSize JVM parameter. Go to WebLogic startup script and add -XMaxPermSize=64m or -XMaxPermSize=128m to JVM startup parameters. If you don't have an application memory leak, this change should take care about the problem.</LI>
<LI></LI>
<LI>Q: But how do I know if it's not an app memory leak?</LI>
<LI></LI>
<LI>A: The first symptom of the app memory leak is that in addition to OutOfMemory, you will see that the memory graph in WebLogic performance console hits the top, and forcing GC doesn't change anything. Fixing this problem is relatively easy. Get a good profiler tool, like OptimizeIt of JProfiler, and run a load test while memory profiling is enabled. Set up a filter to see only your classes and fined ones taking most of memory. It's likely that the same objects will have largest instance counts.</LI>
<LI></LI>
<LI>Tips for setting up a profiler. </LI>
<LI>First, set the JVM memory to as minimum as possible. If you expect WebLogic to run with 1Gb of JVM heap, set it to much lower values at which app can run. It can be 32M, 64M, depending on the app. Is sounds odd, but the reason is that the memory profiler catches JVM GC activities, and as there will be much more object in 1GB than in 64Mb, that GC under profiler will be dead slow, it can be hours, virtually. Set memory to as low as possible. </LI>
<LI></LI>
<LI>Second, turn off anything except the memory profiling. Memory profiling itself is slow, so you will want yo avoid any additional overhead in this case. Performance profiling is to be turned off in any case.</LI></OL></DIV></DIV>
<DIV>&nbsp;</DIV>
<DIV>参考:</DIV>
<DIV><A href="http://topic.csdn.net/u/20080602/09/4bd660f0-9e69-4972-a5c1-ffcbc47c4323.html" target=_blank>http://topic.csdn.net/u/20080602/09/4bd660f0-9e69-4972-a5c1-ffcbc47c4323.html</A></DIV>
<DIV>&nbsp;</DIV>
<DIV><A href="http://efly.itpub.net/post/7315/48273" target=_blank>http://efly.itpub.net/post/7315/48273</A></DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP