Tomcat - 如何限制Tomcat将使用的最大内存 [英] Tomcat - How to limit the maximum memory Tomcat will use

查看:2038
本文介绍了Tomcat - 如何限制Tomcat将使用的最大内存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个小型VPS(256MB / 512MB)上运行Tomcat,我想明确限制Tomcat使用的内存量。

I am running Tomcat on a small VPS (256MB/512MB) and I want to explicitly limit the amount of memory Tomcat uses.

我知道我可以通过传递java最大堆和初始堆大小参数来进行配置;

I understand that I can configure this somehow by passing in the java maximum heap and initial heap size arguments;

-Xmx256m
-Xms128m

找不到在Ubuntu上配置Tomcat 6的位置。

But I can't find where to put this in the configuration of Tomcat 6 on Ubuntu.

提前感谢,

Gav

推荐答案

在您的初始化脚本中设置JAVA_OPTS,

Set JAVA_OPTS in your init script,

 export JAVA_OPTS="-Djava.awt.headless=true -server -Xms48m -Xmx1024M -XX:MaxPermSize=512m"

这篇关于Tomcat - 如何限制Tomcat将使用的最大内存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆