01.JAVA性能調優參考


1.jvm參數

set JAVA_OPTS=-Xms200M -Xmx500M  -XX:PermSize=128M -XX:MaxPermSize=256m -verbose:gc -Xloggc:../logs/gclog.log -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:

+PrintHeapAtGC -XX:+PrintTenuringDistribution -XX:+HeapDumpOnOutOfMemoryError %JAVA_OPTS%
rem set JAVA_OPTS=%JAVA_OPTS% -Xint -Xrunjprofiler:port=8849 -Xbootclasspath/a:D:\02.3968\02.softsetup\jprofiler7\bin\agent.jar;

 

2.Jprofiler集成參數配置
set JAVA_OPTS=%JAVA_OPTS% -agentpath:D:\022F9C~1.396\025CBC~1.SOF\JPROFI~1\bin\windows\jprofilerti.dll=port=8849,nowait 

//具體的Jprofiler參數,通過Jprofiler的session 集成嚮導提示設置;

 在對本地的應用進行跟蹤時,嚮導提示如下:

Integration type: [Generic application]
Selected JVM: Oracle 1.6.0 (hotspot)
Startup mode: Startup immediately, connect later with the JProfiler GUI

(1) Please insert

-agentpath:D:\022F9C~1.396\025CBC~1.SOF\JPROFI~1\bin\windows\jprofilerti.dll=port=8849,nowait

into the start command of your remote application right after the java command.

A remote session named Remote application on localhost will be created that connects to a running instance of the remote application that is started with the modified start command.

 

由嚮導可知,將-agentpath:D:\022F9C~1.396\025CBC~1.SOF\JPROFI~1\bin\windows\jprofilerti.dll=port=8849,nowait 加入到啓動文件的JAVA_OPTS可即可

 

3.配置的具體位置:

catalina.bat文件中

rem ----- Execute The Requested Command ---------------------------------------

set JAVA_OPTS=-Xms200M -Xmx500M  -XX:PermSize=128M -XX:MaxPermSize=256m -verbose:gc -Xloggc:../logs/gclog.log -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:

+PrintHeapAtGC -XX:+PrintTenuringDistribution -XX:+HeapDumpOnOutOfMemoryError %JAVA_OPTS%
rem set JAVA_OPTS=%JAVA_OPTS% -Xint -Xrunjprofiler:port=8849 -Xbootclasspath/a:D:\02.3968\02.softsetup\jprofiler7\bin\agent.jar;
set JAVA_OPTS=%JAVA_OPTS% -agentpath:D:\022F9C~1.396\025CBC~1.SOF\JPROFI~1\bin\windows\jprofilerti.dll=port=8849,nowait

echo Using CATALINA_BASE:   %CATALINA_BASE%
echo Using CATALINA_HOME:   %CATALINA_HOME%
echo Using CATALINA_TMPDIR: %CATALINA_TMPDIR%

 

4.Linux調優參數:
   catalina.sh文件中:

   ---本地vmware linux(Centos)調試驗證參數:

JAVA_OPTS="$JAVA_OPTS -Xms512m -Xmx512m -Xss1024K -XX:PermSize=128m -XX:MaxPermSize=128m -

XX:MaxTenuringThreshold=0 -Xnoclassgc -XX:+DisableExplicitGC -XX:+UseParNewGC -XX:

+UseConcMarkSweepGC -XX:+UseCMSCompactAtFullCollection -XX:CMSFullGCsBeforeCompaction=0 -XX:

+CMSClassUnloadingEnabled -XX:-CMSParallelRemarkEnabled -XX:CMSInitiatingOccupancyFraction=90

-XX:SoftRefLRUPolicyMSPerMB=0 -XX:+PrintClassHistogram -XX:+PrintGCDetails -XX:

+PrintGCTimeStamps -XX:+PrintHeapAtGC"

 

---生產環境 linux參數V0.1:

JAVA_OPTS="$JAVA_OPTS -Xms6000m -Xmx6000m -Xss1024K -XX:PermSize=512m -XX:MaxPermSize=512m -

XX:MaxTenuringThreshold=0 -Xnoclassgc -XX:+DisableExplicitGC -XX:+UseParNewGC -XX:

+UseConcMarkSweepGC -XX:+UseCMSCompactAtFullCollection -XX:CMSFullGCsBeforeCompaction=0 -XX:

+CMSClassUnloadingEnabled -XX:-CMSParallelRemarkEnabled -XX:CMSInitiatingOccupancyFraction=90

-XX:SoftRefLRUPolicyMSPerMB=0 -XX:+PrintClassHistogram -XX:+PrintGCDetails -XX:

+PrintGCTimeStamps -XX:+PrintHeapAtGC -Xloggc:log/gc.log"

 

---生產環境 linux參數V0.2:

JAVA_OPTS="$JAVA_OPTS -Xms8000m -Xmx8000m -Xss1024K -XX:PermSize=512m -XX:MaxPermSize=512m -

XX:MaxTenuringThreshold=0 -Xnoclassgc -XX:+DisableExplicitGC -XX:+UseParNewGC -XX:

+UseConcMarkSweepGC -XX:+UseCMSCompactAtFullCollection -XX:CMSFullGCsBeforeCompaction=8 -XX:

+CMSClassUnloadingEnabled -XX:-CMSParallelRemarkEnabled -XX:CMSInitiatingOccupancyFraction=90

-XX:SoftRefLRUPolicyMSPerMB=0 -XX:+PrintClassHistogram -XX:+PrintGCDetails -XX:

+PrintGCTimeStamps -XX:+PrintHeapAtGC -Xloggc:log/gc.log"

 

發佈了110 篇原創文章 · 獲贊 9 · 訪問量 17萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章