日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

java g1 配置_项目G1 jvm 常规参数配置

發布時間:2023/12/20 编程问答 31 豆豆
生活随笔 收集整理的這篇文章主要介紹了 java g1 配置_项目G1 jvm 常规参数配置 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

目前項目的 G1 JVM參數

目前很多人還是使用 JDK8 ,cms

我認為應該 升級一下了。 因為大佬說一些JVM問題,升級JDK就可以解決的。

而我確實也遇到到 CMS的問題,升級到G1就解決了。

#!/bin/sh

ps -fe|grep bigdoor.jar |grep -v grep

if [ $? -ne 0 ]

then

echo "start process....."

else

echo " is runing....."

ps -ef | grep bigdoor.jar | grep -v grep | awk '{print $2}' | xargs kill -9

echo "shutdown !"

fi

nohup java \

-Xms10g -Xmx10g \

-XX:-UseConcMarkSweepGC -XX:-UseCMSInitiatingOccupancyOnly -XX:+UseG1GC \

-XX:InitiatingHeapOccupancyPercent=65 \

-XX:+AlwaysPreTouch \

-Djava.awt.headless=true \

-Dfile.encoding=UTF-8 \

-XX:SoftRefLRUPolicyMSPerMB=0 \

-XX:-OmitStackTraceInFastThrow \

-XX:+HeapDumpOnOutOfMemoryError \

-XX:HeapDumpPath=/home/log \

-XX:ErrorFile=/home/log/hs_err_pid%p.log \

-Xlog:gc*,gc+age=trace,safepoint:file=/home/log/gc/gc.log:utctime,pid,tags:filecount=32,filesize=64m \

-jar /home/application/bigdoor.jar \

--server.port=8889 --spring.profiles.active=prod > /home/log/bigdoor.log 2>&1 &

echo "啟動成功"

tail -500f /home/log/bigdoor.log

永洪的 G1 Tomcat jvm 參數 參考

/home/yongh/bi/jdk-11.0.4/bin/java -Djava.util.logging.config.file=/home/yongh/8612_CMR/tomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager

-Djdk.tls.ephemeralDHKeySize=2048

-Djava.protocol.handler.pkgs=org.apache.catalina.webresources

-Xmx32768m -Xms32768m

-XX:MetaspaceSize=256m

-XX:G1HeapRegionSize=32m -XX:InitiatingHeapOccupancyPercent=35 -XX:G1ReservePercent=15 -XX:ConcGCThreads=10 -XX:ParallelGCThreads=10 -XX:+ParallelRefProcEnabled -XX:SoftRefLRUPolicyMSPerMB=0 -Xlog:gc*:file=/home/yongh/8612_CMR/tomcat/../Yonghong/log/jvm.log:time:filecount=16 -Djava.awt.headless=true --add-exports java.base/jdk.internal.ref=ALL-UNNAMED --add-opens java.base/jdk.internal.ref=ALL-UNNAMED -XX:OnError=/home/yongh/bi/jdk-11.0.4/bin/jstack %p >/home/yongh/8612_CMR/tomcat/logs/thread_stack_%p.log -XX:ErrorFile=/home/yongh/8612_CMR/tomcat/logs/hs_err_%p.log -XX:OnOutOfMemoryError=/home/yongh/bi/jdk-11.0.4/bin/jmap -dump:format=b,file=/home/yongh/8612_CMR/tomcat/logs/jmap_%p.log %p -XX:+ExitOnOutOfMemoryError -Dignore.endorsed.dirs= -classpath :/home/yongh/8612_CMR/tomcat/webapps/bi/WEB-INF/classes:/home/yongh/8612_CMR/tomcat/../Yonghong/product/api-20200728.jar:/home/yongh/8612_CMR/tomcat/../Yonghong/product/product-20200728.jar:/home/yongh/8612_CMR/tomcat/../Yonghong/product/product-swf-20200728.jar:/home/yongh/8612_CMR/tomcat/../Yonghong/product/thirds.jar:/home/yongh/8612_CMR/tomcat/../Yonghong/lib/customer/customer.jar:/home/yongh/8612_CMR/tomcat/../Yonghong/lib/customer/g5util-8.5-2.1.jar:/home/yongh/8612_CMR/tomcat/../Yonghong/lib/customer.jar:/home/yongh/8612_CMR/tomcat/../Yonghong/lib/g5util-8.5-2.1.jar:/home/yongh/8612_CMR/tomcat/lib/servlet-api.jar:/home/yongh/8612_CMR/tomcat/bin/bootstrap.jar:/home/yongh/8612_CMR/tomcat/bin/tomcat-juli.jar -Dcatalina.base=/home/yongh/8612_CMR/tomcat -Dcatalina.home=/home/yongh/8612_CMR/tomcat -Djava.io.tmpdir=/home/yongh/8612_CMR/tomcat/temp org.apache.catalina.startup.Bootstrap start

ES 的JVM 參數 參考

ES就比較厲害了,發現他的JDK版本基本都是最新的版本的。

因此G1的參數優化 參考ES的即可。

## JVM configuration

################################################################

## IMPORTANT: JVM heap size

################################################################

##

## You should always set the min and max JVM heap

## size to the same value. For example, to set

## the heap to 4 GB, set:

##

## -Xms4g

## -Xmx4g

##

## See https://www.elastic.co/guide/en/elasticsearch/reference/current/heap-size.html

## for more information

##

################################################################

# Xms represents the initial size of total heap space

# Xmx represents the maximum size of total heap space

-Xms1g

-Xmx1g

################################################################

## Expert settings

################################################################

##

## All settings below this section are considered

## expert settings. Don't tamper with them unless

## you understand what you are doing

##

################################################################

## G1GC Configuration

# NOTE: G1GC is only supported on JDK version 10 or later.

# To use G1GC uncomment the lines below.

# 10-:-XX:-UseConcMarkSweepGC

# 10-:-XX:-UseCMSInitiatingOccupancyOnly

# 10-:-XX:+UseG1GC

# 10-:-XX:InitiatingHeapOccupancyPercent=75

## DNS cache policy

# cache ttl in seconds for positive DNS lookups noting that this overrides the

# JDK security property networkaddress.cache.ttl; set to -1 to cache forever

-Des.networkaddress.cache.ttl=60

# cache ttl in seconds for negative DNS lookups noting that this overrides the

# JDK security property networkaddress.cache.negative ttl; set to -1 to cache

# forever

-Des.networkaddress.cache.negative.ttl=10

## optimizations

# pre-touch memory pages used by the JVM during initialization

-XX:+AlwaysPreTouch

## basic

# explicitly set the stack size

-Xss1m

# set to headless, just in case

-Djava.awt.headless=true

# ensure UTF-8 encoding by default (e.g. filenames)

-Dfile.encoding=UTF-8

# use our provided JNA always versus the system one

-Djna.nosys=true

# turn off a JDK optimization that throws away stack traces for common

# exceptions because stack traces are important for debugging

-XX:-OmitStackTraceInFastThrow

# flags to configure Netty

-Dio.netty.noUnsafe=true

-Dio.netty.noKeySetOptimization=true

-Dio.netty.recycler.maxCapacityPerThread=0

# log4j 2

-Dlog4j.shutdownHookEnabled=false

-Dlog4j2.disable.jmx=true

-Djava.io.tmpdir=${ES_TMPDIR}

## heap dumps

# generate a heap dump when an allocation from the Java heap fails

# heap dumps are created in the working directory of the JVM

-XX:+HeapDumpOnOutOfMemoryError

# specify an alternative path for heap dumps; ensure the directory exists and

# has sufficient space

-XX:HeapDumpPath=data

# specify an alternative path for JVM fatal error logs

-XX:ErrorFile=logs/hs_err_pid%p.log

# JDK 9+ GC logging

9-:-Xlog:gc*,gc+age=trace,safepoint:file=logs/gc.log:utctime,pid,tags:filecount=32,filesize=64m

# due to internationalization enhancements in JDK 9 Elasticsearch need to set the provider to COMPAT otherwise

# time/date parsing will break in an incompatible way for some date patterns and locals

9-:-Djava.locale.providers=COMPAT

gc log 配置參考

gc log 配置 優化

-Xlog:gc*,gc+age=trace,safepoint:file=/home/log/gc/gc.log:utctime,pid,tags:filecount=32,filesize=64m 如果這樣配置,

結果我將gc.log 放入 gcviewer 里面進行分析,就報錯了,因為格式不對。 或者將其上傳 到 http://gceasy.io/ 上面分析也是報錯。

也就是上面的方式是不對的。不利于利用工具進行分析 gc

https://github.com/chewiebug/GCViewer/issues/245

需要下面的格式才可以分析 GC log

下面的就可以使用 gcviewer 和 gceasy 線上去分析了

-Xlog:gc*=info:file=/home/log/gc/gc.log:tags,time,uptime,level

https://segmentfault.com/a/1190000013475524

https://blog.csdn.net/zhxdick/article/details/104556869

總結

以上是生活随笔為你收集整理的java g1 配置_项目G1 jvm 常规参数配置的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。