免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2143 | 回复: 4
打印 上一主题 下一主题

请教一个tomcat的问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2004-03-11 21:02 |只看该作者 |倒序浏览
tomcat建立一个站点,访问量比较高,运行一天左右的时间后,站点不能访问,察看tomcat日志,提示outofmemory错误,系统物理内存1G,察看当时使用的内存300M左右,是solaris9的系统,swap分区1G。请问该怎么解决阿,非常感谢,我很着急!

论坛徽章:
0
2 [报告]
发表于 2004-03-12 09:30 |只看该作者

请教一个tomcat的问题

java有一个-Xms的选项
http://www.chinaunix.net/jh/26/152236.html

改一下tomcat的启动脚本,加上相应参数吧

论坛徽章:
0
3 [报告]
发表于 2004-03-12 09:31 |只看该作者

请教一个tomcat的问题

Why do I get OutOfMemoryError errors?
Many reasons.
You're out of memory. Simple as that - add more to your heap.
You're out of memory. You have code which is hanging onto object references and the garbage collector can't do its job. Get a profiler to debug this one.
You ran out of file descriptors. If you are on a *nix system, it has been observed that an OutOfMemoryError can be thrown if you run out of file descriptors. This can occur if your threshold is too low. The ulimit program can help you out here. You also may need to account for socket connections too when thinking about these thresholds. Google is your friend for getting more information about this topic.
You have too many threads running. Some OS's have a limit to the number of threads which may be executed by a single process. (Which is what the JVM is.) Refer to your OS docs for more information on how to raise this threshold.
Your OS limits the amount of memory your process may take. OK, this one is grasping at straws.
The JVM has a bug. This has been known to happen with JVM1.2.? and using EJB's with another servlet engine.
Not actually a reason - but on your particular platform, look at the java -X options. They may be VERY helpful.

How much memory is Tomcat/webapp/??? using?
To find out how much memory Tomcat is using, you might be able to use the Runtime class provided by the JDK.
You can't find out how much memory a webapp is using. The JVM doesn't give us these detail.
You can't find out how much memory a ??? is using. The JVM doesn't give us these detail.
That being said, a memory profiling tool might prove the above statements wrong - but you probably don't want to use them in a production environment.

论坛徽章:
0
4 [报告]
发表于 2004-03-12 12:44 |只看该作者

请教一个tomcat的问题

增加了设置-Xms256m -Xmx512m,可是问题依旧,还是实际使用到300M左右时就死掉了,我该怎么办

原文如下,原来没有-Xms -Xmx选项,实在catalina.sh里面修改的
不知道这样正不正确
if [ -z "$JPDA_OPTS" ] ; then
  JPDA_OPTS="-classic -Xms256m -Xmx512m -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n"
fi

论坛徽章:
0
5 [报告]
发表于 2004-03-13 13:44 |只看该作者

请教一个tomcat的问题

试试把 mx 设为 768m,如果在 500M 左右死掉,说明你的程序有 memory leak。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP