`

tomcat内存优化设置

阅读更多
服务器运行一段时间就会崩溃,查看日志发现崩溃前抛出的是内存不够的异常,部署的时候没有对内存进行优化设置,采用的是默认设置,服务器配置高,不用也是浪费,于是查了些与内存设置有关的文档,在这里把与内存优化相关的做下记录。
出现out of memory可能的原因(摘自tomcat wiki)
1.You're out of memory. Simple as that - add more to your heap.
2.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.
3.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.
4.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.
5.If you have a lot of servlets or JSP's, you may need to increase your permanent generation. By default, it is 64MB. Quadrupling it to be -XX:MaxPermSize=256m might be a good start.
6.Your OS limits the amount of memory your process may take. OK, this one is grasping at straws.
7.The JVM has a bug. This has been known to happen with JVM1.2.? and using EJB's with another servlet engine.
8.Not actually a reason - but on your particular platform, look at the java -X options. They may be VERY helpful.
9.Your classloaders are not being garbage collected.
10.You run out of process memory (non java/GC memory), for example when using java.util.zip classes or JNI classes allocating process memory. See Instantiating Inflater/Deflater causes OutOfMemoryError; finalizers not called promptly enough
翻译过来的意思是:
1.用完了内存
2.代码有内存泄露的bug
3.用完了文件描述符。linux系统中文件数量限制有两个方面:硬盘空间和文件描述符数量。具体详情请google。
4.有太多线程在运行。有些操作系统会限制线程数量。
5.有太多的servlet或JSP,这占用了大量的permanent generation。
6.操作系统限制了进程可以使用的内存大小。
7.JVM有bug。目前已知JM1.2有bug。
8.不明原因。建议打开java -X选项查看原因。
9.类加载器没有被gc回收。
10。程序用完了内存(不是java内存)比如用native方法申请了很多的内存。
分析了程序大概的原因是第一条,用完了JVM申请的内存,于是查找tomcat的JVM内存分配优化。具体做法:
修改CATALINA_HOME/bin/catalina.sh文件,在开头加上JAVA_OPTS='-Xms8192m -Xmx8192m -XX:MaxPermSize=512m'
2
0
分享到:
评论

相关推荐

    tomcat虚拟内存设置

    tomcat默认可以使用的内存为128MB,在较大型的应用项目中,这点内存是不够的,轻微时,会使系统性能急剧下降,严重时,将导致系统无法运行,影响系统的稳定性。

    查看Tomcat内存文件

    这是一个查看Tomcat内存的文件。放在应用工程中,直接访问就可以。 个人感觉这是一个非常有用的文件。

    监控tomcat内存使用情况

    监控tomcat内存使用情况

    Tomcat内存优化

    Tomcat内存优化

    Tomcat JVM内存优化(Linux环境)

    Linux环境的Tomcat JVM内存优化 java虚拟机内存溢出问题的解决

    tomcat 内存优化

    tomcat内存溢出分析及解决方案,主要是分析tomcat内存溢出原因及对应的解决方案

    tomcat内存优化

    tomcat的内存优化...一般很难找到这么齐全的了

    Tomcat JVM内存设置方法

    Tomcat JVM虚拟机默认内存1800 M左右,当服务内存不够用时,需要手动设置内存大小,不可超过服务器系统内存的80%,本文档提供设置方法(使用命令启动有效),实测可用。

    tomcat内存监测工具probe。

    可以监测tomcat设置的内存是否生效,监测当前使用的内存和剩余内存,监测当前在线用户量。不错的工具,作为一个tomcat的web项目运行,不需要额外安装插件和程序。登录用户直接使用tomcat的用户,请有conf\tomcat_...

    扩大Tomcat内存

    所以此时提供另外一种增大Tomcat内存的方法:打开tomcat目录下\bin\tomcat7w.exe,点击Java选项卡,然后将会发现其中有这么两项:Initial memory pool和Maximum memory pool,其中Initial memory pool这个就是初始化...

    TOMCAT内存大小调整

    在使用Java程序从数据库中查询大量的数据或是应用服务器(如tomcat、jboss,weblogic)加载jar包时会出现java.lang.OutOfMemoryError异常。这主要是由于应用服务器的内存不足引起的。

    设置tomcat启动内存大小

    给tomcat设置使用内存,在配置文件中加入一段代码即可!

    优化Tomcat配置(内存、并发、缓存等方面)方法详解

    Tomcat内存优化主要是对 tomcat 启动参数优化,我们可以在 tomcat 的启动脚本 catalina.sh 中设置 java_OPTS 参数。 JAVA_OPTS参数说明 server 启用jdk 的 server 版; -Xms java虚拟机初始化时的最小内存; -...

    LINUX部署tomcat内存溢出解决方案.txt

    LINUX部署tomcat内存溢出解决方案 已经使用过了,确实是好用的。

    Tomcat内存泄露问题排查

    使用内存分析工具从众多的对象中进行分析,快速的计算出在内存中对象的占用大小,看看是谁阻止了垃圾收集器的回收工作,并可以通过报表直观的查看到可能造成这种结果的对象。 当服务器应用占用了过多内存的时候,会...

    改善tomcat内存不足

    改善使用tomcat的过程中内存的优化,内存的不足等等

    tomcat内存监控程序

    该程序能实时监控Tomcat服务器的运行内存,给运维人员提供可靠的消息,方便Tomcat的性能优化。

    Tomcat加载到虚拟内存、端口设置、内存加大

    文档是自己在使用过程中总结的,有什么不足之处,还请谅解。

    linux下tomcat优化设置最大连接数内存jconsole监控.docx

    linux下tomcat优化设置最大连接数内存jconsole监控.docx

    tomcat部署与内存调优

    TOMCAT应用服务器部署与内存调优 1、描述Tomcat应用服务器安装部署。 2、关于TOMCAT内存溢出及适当调整JVM内存大小。

Global site tag (gtag.js) - Google Analytics