????Linux?????JVM????С:
??????????tomcat ??bin ??catalina.sh????У????cygwin=false????????е?????????????????????# vi TOMCAT_HOME/bin/catalina.sh(??????????)
?????????????????????????????setenv.sh?????????tomcat??棬???????????????
????#vi /opt/app/tomcat6/bin/setenv.shexport JAVA_OPTS="-server -Xms512m -Xmx1024m -XX:MaxNewSize=512m -XX:PermSize=128m -XX:MaxPermSize=256m -XX:SurvivorRatio=14 -XX:+UseParallelOldGC"????????tomcat?????????#vi TOMCAT_HOME/bin/catalina.shJAVA_OPTS="-server -Xms512m -Xmx1024m -XX:MaxNewSize=512m -XX:PermSize=128m -XX:MaxPermSize=256m -XX:SurvivorRatio=14 -XX:+UseParallelOldGC"
????jvm?????????
????-server ??????????????????????JDK??server?汾??????CPU??????
????-Xms java Heap?????С?? ?????????????1/64??
????-Xmx java heap?????????????????????80%???????????????檔
????-Xmn java heapС???????????Xmx??3??4??????
????-XX:PermSize ?趨??????????????С??????64M??
????-XX:MaxPermSize ?趨????????????С??????64M??
????-XX:SurvivorRatio=2 ?????????С???????2???????????????????????????????????????????
????-XX:NewSize ?????????????С?? ????2M??
????-XX:MaxNewSize ???????????С?? ????32M??
????+XX:AggressiveHeap ??jvm????Xmx????????????????G??????棬???????G??swap??
????-Xss ???????Stack??С
????-verbose:gc ?????????????
????-Xloggc:gc.log ????????????????
????-XX:+UseParNewGC ????minor????????
????-XX:+UseConcMarkSweepGC ????major????????
????-XX:userParNewGC ?????????ò??????(??CPU)
????-XX:ParallelGCThreads ????????????ж?(??CPU)
????-XX:UseParallelGC ???ú??????ò???????????(??CPU)
????-XX:+UseParallelOldGC???????????????????????????????JDK6.0??????????????????
????Windows?????JVM????С:
????????:????汾??Tomcat?? ????startup.bat???tomcat???????????
??????????tomcat ??bin ??catalina.bat ??rem Guess CATALINA_HOME if not defined
????set CURRENT_DIR=%cd%????????
????set JAVA_OPTS="-server -Xms800m -Xmx3072m -XX:PermSize=512m -XX:MaxNewSize=256m -XX:MaxPermSize=1024m"
????????(???????)??
????????JVM???????????
???????????
????-Xms:??????С
????-Xmx:????С
????-XX:NewSize=n:???????????С
????-XX:NewRatio=n:????????????????????????:?3?????????????????????1??3?????????????????????????1/4
????-XX:SurvivorRatio=n:???????Eden????????Survivor???????????Survivor???????????磺3?????Eden??
????Survivor=3??2?????Survivor??????????????1/5
????-XX:MaxPermSize=n:???ó?????С
??????????????
????-XX:+UseSerialGC:????????????
????-XX:+UseParallelGC:???ò????????
????-XX:+UseParalledlOldGC:???ò?????????????
????-XX:+UseConcMarkSweepGC:???ò????????
???????????????????
????-XX:+PrintGC
????-XX:+PrintGCDetails
????-XX:+PrintGCTimeStamps
????-Xloggc:filename
??????????????????
????-XX:ParallelGCThreads=n:???ò????????????????CPU??????????????????
????-XX:MaxGCPauseMillis=n:???ò??????????????
????-XX:GCTimeRatio=n:????????????????????????????????????1/(1+n)
??????????????????
????-XX:+CMSIncrementalMode:????????????????????CPU?????
????-XX:ParallelGCThreads=n:???ò??????????????????????????????????CPU??????????????????