首页 > 运维 > linux运维 > 正文

Linux下Tomcat8怎么修改JVM内存配置

WBOY
发布: 2023-06-03 08:43:27
转载
2978 人浏览过

Tomcat8如何修改JVM内存配置

Tomcat并不建议直接在catalina.sh里配置变量,而是写在与catalina同级目录(bin目录)下的setenv.sh里。

Linux下Tomcat8怎么修改JVM内存配置

所以如果我们想要修改jvm的内存配置

那么我们就需要修改setenv.sh文件(默认没有,需新建一个setenv.sh),写入(大小根据自己情况修改):

export CATALINA_OPTS="$CATALINA_OPTS -Xms1000m"
export CATALINA_OPTS="$CATALINA_OPTS -Xmx1000m"
export CATALINA_OPTS="$CATALINA_OPTS -XX:MaxPermSize=256m"
登录后复制

设置之后在Tomcat启动

你会发现: 

Linux下Tomcat8怎么修改JVM内存配置

cation directory [/usr/local/apache-tomcat-8.5.33/webapps/manager] has finished in [11] ms
06-Sep-2018 14:18:17.690 信息 [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8088"]
06-Sep-2018 14:18:17.702 信息 [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8009"]
06-Sep-2018 14:18:17.707 信息 [main] org.apache.catalina.startup.Catalina.start Server startup in 10577 ms
[INFO] Working directory is /usr/local/apache-tomcat-8.5.33
[INFO] War root is /usr/local/apache-tomcat-8.5.33/webapps/cat
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
06-Sep-2018 14:55:15.068 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Server version:        Apache Tomcat/8.5.33
06-Sep-2018 14:55:15.073 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Server built:          Aug 12 2018 08:20:08 UTC
06-Sep-2018 14:55:15.073 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Server number:         8.5.33.0
06-Sep-2018 14:55:15.073 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name:               Linux
06-Sep-2018 14:55:15.073 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version:            3.10.0-229.el7.x86_64
06-Sep-2018 14:55:15.073 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture:          amd64
06-Sep-2018 14:55:15.073 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home:             /usr/local/jdk1.8.0_171/jre
06-Sep-2018 14:55:15.073 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version:           1.8.0_171-b11
06-Sep-2018 14:55:15.073 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor:            Oracle Corporation
06-Sep-2018 14:55:15.073 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE:         /usr/local/apache-tomcat-8.5.33
06-Sep-2018 14:55:15.073 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME:         /usr/local/apache-tomcat-8.5.33
06-Sep-2018 14:55:15.074 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=/usr/local/apache-tomcat-8.5.33/conf/logging.properties
06-Sep-2018 14:55:15.074 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
06-Sep-2018 14:55:15.074 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
06-Sep-2018 14:55:15.074 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources
06-Sep-2018 14:55:15.074 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dorg.apache.catalina.security.SecurityListener.UMASK=0027
06-Sep-2018 14:55:15.074 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xms1000m
06-Sep-2018 14:55:15.074 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xmx1000m
06-Sep-2018 14:55:15.074 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -XX:MaxPermSize=256m
06-Sep-2018 14:55:15.074 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dignore.endorsed.dirs=
06-Sep-2018 14:55:15.074 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=/usr/local/apache-tomcat-8.5.33
06-Sep-2018 14:55:15.075 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=/usr/local/apache-tomcat-8.5.33
06-Sep-2018 14:55:15.075 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=/usr/local/apache-tomcat-8.5.33/temp
06-Sep-2018 14:55:15.075 信息 [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib]
06-Sep-2018 14:55:15.236 信息 [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8088"]
06-Sep-2018 14:55:15.248 信息 [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
06-Sep-2018 14:55:15.255 信息 [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8009"]
06-Sep-2018 14:55:15.257 信息 [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
06-Sep-2018 14:55:15.259 信息 [main] org.apache.catalina.startup.Catalina.load Initialization processed in 602 ms
06-Sep-2018 14:55:15.302 信息 [main] org.apache.catalina.core.StandardService.startInternal Starting service [Catalina]
06-Sep-2018 14:55:15.302 信息 [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.5.33
06-Sep-2018 14:55:15.327 信息 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive [/usr/local/apache-tomcat-8.5.33/webapps/cat.war]
06-Sep-2018 14:55:18.042 信息 [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
06-Sep-2018 14:55:33.944 警告 [localhost-startStop-1] org.apache.catalina.util.SessionIdGeneratorBase.createSecureRandom Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [15,876] milliseconds.
Logger file /data/applogs/cat/cat_20180906.log 

[root@localhost bin]# ./startup.sh 
Using CATALINA_BASE:   /usr/local/apache-tomcat-8.5.33
Using CATALINA_HOME:   /usr/local/apache-tomcat-8.5.33
Using CATALINA_TMPDIR: /usr/local/apache-tomcat-8.5.33/temp
Using JRE_HOME:        /usr/local/jdk1.8.0_171/jre
Using CLASSPATH:       /usr/local/apache-tomcat-8.5.33/bin/bootstrap.jar:/usr/local/apache-tomcat-8.5.33/bin/tomcat-juli.jar
Tomcat started.
[root@localhost bin]# uname -a
Linux localhost.localdomain 3.10.0-229.el7.x86_64 #1 SMP Fri Mar 6 11:36:42 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
[root@localhost bin]# 

以上是Linux下Tomcat8怎么修改JVM内存配置的详细内容。更多信息请关注PHP中文网其他相关文章!

相关标签:
来源:yisu.com
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板