首页 > 其他分享 >toamcat 配置记录 setenv

toamcat 配置记录 setenv

时间:2023-01-04 17:36:55浏览次数:67  
标签:CATALINA JAVA garbage 记录 XX setenv rem toamcat OPTS

server.xml 配置(注意版本)

https://tomcat.apache.org/tomcat-9.0-doc/config/http.html

 

setenv.bat

rem set "JAVA_OPTS=%JAVA_OPTS% -Xms8G -Xmx8G -XX:PermSize=512M -XX:MaxNewSize=512M -XX:MaxPermSize=512M -server -Dfile.encoding=UTF-8"

rem ==================================================================
rem discourage address map swapping by setting Xms and Xmx to the same value
rem http://confluence.atlassian.com/display/DOC/Garbage+Collector+Performance+Issues
set "JAVA_OPTS=%JAVA_OPTS% -Xms10g"
set "JAVA_OPTS=%JAVA_OPTS% -Xmx10g"

rem Increase maximum perm size for web base applications to 4x the default amount
rem http://wiki.apache.org/tomcat/FAQ/Memoryhttp://wiki.apache.org/tomcat/FAQ/Memory
set "JAVA_OPTS=%JAVA_OPTS% -XX:MaxMetaspaceSize=1g"

rem Reset the default stack size for threads to a lower value (by 1/10th original)
rem By default this can be anywhere between 512k -> 1024k depending on x32 or x64
rem bit Java version.
rem http://www.springsource.com/files/uploads/tomcat/tomcatx-large-scale-deployments.pdf
rem http://www.oracle.com/technetwork/java/hotspotfaq-138619.html
set "JAVA_OPTS=%JAVA_OPTS% -Xss228k"

rem Oracle Java as default, uses the serial garbage collector on the
rem Full Tenured heap. The Young space is collected in parallel, but the
rem Tenured is not. This means that at a time of load if a full collection
rem event occurs, since the event is a 'stop-the-world' serial event then
rem all application threads other than the garbage collector thread are
rem taken off the CPU. This can have severe consequences if requests continue
rem to accrue during these 'outage' periods. (specifically webservices, webapps)
rem [Also enables adaptive sizing automatically]
set "JAVA_OPTS=%JAVA_OPTS% -XX:+UseParallelGC"

rem This is interpreted as a hint to the garbage collector that pause times
rem of <nnn> milliseconds or less are desired. The garbage collector will
rem adjust the  Java heap size and other garbage collection related parameters
rem in an attempt to keep garbage collection pauses shorter than <nnn> milliseconds.
rem http://java.sun.com/docs/hotspot/gc5.0/ergo5.html
set "JAVA_OPTS=%JAVA_OPTS% -XX:MaxGCPauseMillis=1500"

rem A hint to the virtual machine that it.s desirable that not more than:
rem 1 / (1 + GCTimeRation) of the application execution time be spent in
rem the garbage collector.
rem http://themindstorms.wordpress.com/2009/01/21/advanced-jvm-tuning-for-low-pause/
set "JAVA_OPTS=%JAVA_OPTS% -XX:GCTimeRatio=9 -XX:+UseAdaptiveSizePolicy"

rem file encoding
set "JAVA_OPTS=%JAVA_OPTS% -Dfile.encoding=UTF-8"

rem The hotspot server JVM has specific code-path optimizations
rem which yield an approximate 10% gain over the client version.
set "JAVA_OPTS=%JAVA_OPTS% -server"

rem Disable remote (distributed) garbage collection by Java clients
rem and remove ability for applications to call explicit GC collection
set "JAVA_OPTS=%JAVA_OPTS% -XX:+DisableExplicitGC"

rem out of memory dump
set "JAVA_OPTS=%JAVA_OPTS% -XX:+HeapDumpOnOutOfMemoryError"
set "JAVA_OPTS=%JAVA_OPTS% -XX:HeapDumpPath=%CATALINA_BASE%\heapdump\ppm.hprof"

 

setenv.sh

#! /bin/sh
# ==================================================================
# 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 -Xms4g"
export CATALINA_OPTS="$CATALINA_OPTS -Xmx4g"

# 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:MaxMetaspaceSize=1g"

# 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 -Xss228k"

# 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 -XX:+UseAdaptiveSizePolicy"

# 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"

#out of memory dump
export CATALINA_OPTS="$CATALINA_OPTS -XX:+HeapDumpOnOutOfMemoryError"
export CATALINA_OPTS="$CATALINA_OPTS -XX:HeapDumpPath=/root/heapdump/ppm.hprof"

# 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 ""

 

标签:CATALINA,JAVA,garbage,记录,XX,setenv,rem,toamcat,OPTS
From: https://www.cnblogs.com/besehen/p/17025521.html

相关文章

  • 【HMS Core】运动健康服务,更新订阅记录接口报错
    问题描述:集成运动健康服务时,注册订阅记录新增/更新订阅记录时,接口调试报错FailedtoconnecttotheURL​问题分析:订阅记录创建之前,需检查订阅回调地址的连通性。返回“Fai......
  • react-hook-form 问题记录
    react-hook-form里面如何改变单个字段的校验时机比如email字段不需要在onChange的时候校验就不要用useController钩子给的onChange去改值相反,要用useFormContext给的setV......
  • Mysql错误问题记录
    ①Incorrectstringvalue:'\xE6\x94\xBE\xE5\xA4\xA7...'forcolumn'name'atrow1Query……原因:编码不匹配。数据库是latin1编码,而插入的中文字符串是utf-8编码。......
  • STS(Spring Tool Suite)使用小技巧记录
    偶尔有些jar包无论如何都无法用maven下载,(例如我正在用的kaptcha)只好自己手动下载了以后再添加。这个时候记得修改以下地方。自动的VMware服务器无法启动,报错如下图解决办法,......
  • Spark入门学习记录之SparkLearning
    为了更好的学习和理解spark,也为了记录自己学习过程中的遇到的各种问题,方便以后查询,故谢了相关博客,也公开了代码和数据,代码基本都可以本地运行。论文部分由于是ppt,故没有放上......
  • Adam学习22之在window下使用idea的maven编译安装记录
    1.mvninstallD:\1win7\java\jdk\bin\java-Dmaven.multiModuleProjectDirectory=D:\all\idea\adam-adam-parent_2.10-0.19.0-Dmaven.home=D:\1win7\java\apache-maven-3.3......
  • [数学记录] AGC038C LCMs
    题目柿子Code......
  • 关于 safari浏览器 不支持new Date 显示NaN的问题记录
    知识点:newDate问题: safari浏览器 显示NaN因为 JS中要求Date类型转换的原始数据格式是yyyy/mm/dd之类的,所以横岗-要替换掉才可以今天同事来问,我一看果然啊,mac版高......
  • .net core(.net 6) 日志记录 log4net ----将日志写入txt文本
    .net6框架内置了log,但是该log只能在控制台打印日志,在实际项目中我们需要将日志实现持久化,将日志写进文档、写入数据库等,所以选择了log4net。1、引入NuGet包Microsoft.......
  • 图文并茂记录下重新配置MAC系统Flutter环境
    Flutter是什么Flutter是Google开源的构建用户界面(UI)工具包,帮助开发者通过一套代码库高效构建多平台精美应用,支持移动、Web、桌面和嵌入式平台。Flutter 开源、免费,拥有......