tomcat实例CATALINA_BASE/bin下的setenv.sh文件中设置
export CATALINA_OPTS="$CATALINA_OPTS -Xms1024m"
export CATALINA_OPTS="$CATALINA_OPTS -Xmx1024m"
export CATALINA_OPTS="$CATALINA_OPTS -Xmn128m"
export CATALINA_OPTS="$CATALINA_OPTS -XX:PermSize=128m"
export CATALINA_OPTS="$CATALINA_OPTS -XX:MaxPermSize=128m"
export CATALINA_OPTS="$CATALINA_OPTS -server"
export CATALINA_OPTS="$CATALINA_OPTS -Dfile.encoding=UTF8"
export CATALINA_OPTS="$CATALINA_OPTS -Djava.awt.headless=true"
echo "Using CATALINA_OPTS:$CATALINA_OPTS"
tomcat服务器端jvm优化设置
可以在对应tomcat实例CATALINA_BASE/bin下的setenv.sh文件中设置,如果没有该文件先创建该脚本文件
然后在其中设置jvm的优化参数。
http://doc.cloveretl.com/documentation/UserGuide/index.jsp?topic=/com.cloveretl.server.docs/docs/tomcat.html
如:
-
It is strongly recommended you change default limits for the heap
and perm gen
memory spaces.
See section the section called “Memory Settings” for details.
You can set the minimum and maximum memory heap size by adjusting the "Xms" and "Xmx" JVM parameters. You can set JVM parameters for Tomcat by setting the environment variable JAVA_OPTS
in the [TOMCAT_HOME]/bin/setenv.sh
file (if it does not exist, you may create it).
Create setenv file:
Unix-like systems: [tomcat]/bin/setenv.sh
export CATALINA_OPTS="$CATALINA_OPTS -XX:MaxPermSize=512m -Xms128m -Xmx1024m"
export CATALINA_OPTS="$CATALINA_OPTS -Dderby.system.home=$CATALINA_HOME/temp -server"
echo "Using CATALINA_OPTS: $CATALINA_OPTS"
Windows systems: [tomcat]/bin/setenv.bat
set "CATALINA_OPTS=%CATALINA_OPTS% -XX:MaxPermSize=512m -Xms128m -Xmx1024m"
set "CATALINA_OPTS=%CATALINA_OPTS% -Dderby.system.home=%CATALINA_HOME%/temp -server"
echo "Using CATALINA_OPTS: %CATALINA_OPTS%"
As visible in the settings above, there is also switch -server
. For performance reasons, it is recommended to run the container in the "server" mode.
示例2:
https://gist.github.com/terrancesnyder/986029
#! /bin/sh
# ==================================================================
# ______ __ _____
# /_ __/___ ____ ___ _________ _/ /_ /__ /
# / / / __ \/ __ `__ \/ ___/ __ `/ __/ / /
# / / / /_/ / / / / / / /__/ /_/ / /_ / /
#/_/ \____/_/ /_/ /_/\___/\__,_/\__/ /_/
# Multi-instance Apache Tomcat installation with a focus
# on best-practices as defined by Apache, SpringSource, and MuleSoft
# and enterprise use with large-scale deployments.
# Credits:
# Google -> Couldn't survive without it
# Stackoverflow.com -> Community support
# SpringSource -> Specifically best-practices and seminars (Expert Series)
# Based On:
# http://www.springsource.com/files/uploads/tomcat/tomcatx-performance-tuning.pdf
# http://www.springsource.com/files/u1/PerformanceTuningApacheTomcat-Part2.pdf
# http://www.springsource.com/files/uploads/tomcat/tomcatx-large-scale-deployments.pdf
# Created By: Terrance A. Snyder
# URL: http://www.terranceasnyder.com, http://shutupandcode.net
# Best Practice Documentation:
# http://terranceasnyder.com/2011/05/tomcat-best-practices/
# Looking for the latest version?
# github @ https://github.com/terrancesnyder
# ==================================================================
# discourage address map swapping by setting Xms and Xmx to the same value
# http://confluence.atlassian.com/display/DOC/Garbage+Collector+Performance+Issues
export CATALINA_OPTS="$CATALINA_OPTS -Xms64m"
export CATALINA_OPTS="$CATALINA_OPTS -Xmx512m"
# Increase maximum perm size for web base applications to 4x the default amount
# http://wiki.apache.org/tomcat/FAQ/Memoryhttp://wiki.apache.org/tomcat/FAQ/Memory
export CATALINA_OPTS="$CATALINA_OPTS -XX:MaxPermSize=256m"
# Reset the default stack size for threads to a lower value (by 1/10th original)
# By default this can be anywhere between 512k -> 1024k depending on x32 or x64
# bit Java version.
# http://www.springsource.com/files/uploads/tomcat/tomcatx-large-scale-deployments.pdf
# http://www.oracle.com/technetwork/java/hotspotfaq-138619.html
export CATALINA_OPTS="$CATALINA_OPTS -Xss192k"
# Oracle Java as default, uses the serial garbage collector on the
# Full Tenured heap. The Young space is collected in parallel, but the
# Tenured is not. This means that at a time of load if a full collection
# event occurs, since the event is a 'stop-the-world' serial event then
# all application threads other than the garbage collector thread are
# taken off the CPU. This can have severe consequences if requests continue
# to accrue during these 'outage' periods. (specifically webservices, webapps)
# [Also enables adaptive sizing automatically]
export CATALINA_OPTS="$CATALINA_OPTS -XX:+UseParallelGC"
# This is interpreted as a hint to the garbage collector that pause times
# of <nnn> milliseconds or less are desired. The garbage collector will
# adjust the Java heap size and other garbage collection related parameters
# in an attempt to keep garbage collection pauses shorter than <nnn> milliseconds.
# http://java.sun.com/docs/hotspot/gc5.0/ergo5.html
export CATALINA_OPTS="$CATALINA_OPTS -XX:MaxGCPauseMillis=1500"
# A hint to the virtual machine that it.s desirable that not more than:
# 1 / (1 + GCTimeRation) of the application execution time be spent in
# the garbage collector.
# http://themindstorms.wordpress.com/2009/01/21/advanced-jvm-tuning-for-low-pause/
export CATALINA_OPTS="$CATALINA_OPTS -XX:GCTimeRatio=9"
# The hotspot server JVM has specific code-path optimizations
# which yield an approximate 10% gain over the client version.
export CATALINA_OPTS="$CATALINA_OPTS -server"
# Disable remote (distributed) garbage collection by Java clients
# and remove ability for applications to call explicit GC collection
export CATALINA_OPTS="$CATALINA_OPTS -XX:+DisableExplicitGC"
# Check for application specific parameters at startup
if [ -r "$CATALINA_BASE/bin/appenv.sh" ]; then
. "$CATALINA_BASE/bin/appenv.sh"
fi
echo "Using CATALINA_OPTS:"
for arg in $CATALINA_OPTS
do
echo ">> " $arg
done
echo ""
echo "Using JAVA_OPTS:"
for arg in $JAVA_OPTS
do
echo ">> " $arg
done
echo "_______________________________________________"
echo ""
相关推荐
Tomcat JVM虚拟机默认内存1800 M左右,当服务内存不够用时,需要手动设置内存大小,不可超过服务器系统内存的80%,本文档提供设置方法(使用命令启动有效),实测可用。
Linux环境的Tomcat JVM内存优化 java虚拟机内存溢出问题的解决
tomcat-jvm优化。配置内存、最大连接数等信息。
java虚拟机jvm及Tomcat中的jvm有关内存的设置与调优
tomcat7安装使用及jvm连接数参数调优
JVM优化入门,优化tomcat执行效率提高tomcat请求响应效率。基于CMS是用于对tenured generation的回收,也就是年老代的回收,目标是尽量减少应用的暂停时间,减少full gc发生的几率,利用和应用程序线程并发的垃圾...
JVM优化3(Tomcat参数调优,JVM参数调优,jvm字节码,代码优化),供大家查阅!!!!!!!!!!!!!!
redis集群jvm调优实战MySQL5.6性能优化&Tomcat7优化
1 什么是性能优化\ 2 性能测试与优化\ 3 性能优化JVM篇\ 4 性能优化Tomcat篇\ 5 性能优化mysql篇\
tomcat-jvm参数调优配置,以及常用参数的配置方式。并发数优化
JVM优化3(Tomcat参数调优,JVM参数调优,jvm字节码,代码优化).zip
Tomcat性能优化及JVM内存工作原理,适用于运维人员,开发人员
Tomcat 调优及 JVM 参数优化。 一篇文章带你快速了解!
jvm参数优化后,tomcat稳定可靠,附件为通过长时间在线测试的配置参数文件
课程内容包括了Nginx进阶基础,Nginx配置提升,JVM虚拟机尝试,JVM运维实用排障工具,JVM监控工具,Tomcat配置,Tomcat运维与部署等Web服务器的必备运维部署技术。 ===============课程目录=============== (1)\...
- 了解下我们为什么要学习JVM优化 - 掌握jvm的运行参数以及参数的设置 - 掌握jvm的内存模型(堆内存) - 掌握jamp命令的使用以及通过MAT工具进行分析 - 掌握定位分析内存溢出的方法 - 掌握jstack命令的使用 - 掌握...
tomcat7 优化 性能调优,优化tomcat的配置,修改启动模式,开启并且使用线程池,JVM优化,图文说明
jvm优化;
网盘文件永久链接 目录 day1: 1 为什么要对jvm做优化 2 jvm的运行参数 3 jvm的内存模型 4 jmap的使用以及内存溢出分析 5 实战:内存溢出的定位与分析 ...1 Tomcat8优化 2 JVM字节码 3 代码优化 .........