Tomcat Server 預設可使用的記憶體為 128M,
若有大量網頁需求時, 會因記憶體太少, 而導致 Tomcat 當掉無法運作,
所以, 若要應付大量網頁的需求,需增加JVM的記憶體大小如下:
First Calculate the number of threads you can create
(MaxProcessMemory - JVMMemory - ReservedOsMemory) / (ThreadStackSize) = Number of threads
Example:
For Java 1.5 you will get the following results assuming that the OS reserves about 120MB:
1.5GB allocated to JVM: (2GB-1.5Gb-120MB)/(1MB) = ~380 threads
1.0GB allocated to JVM: (2GB-1.0Gb-120MB)/(1MB) = ~880 threads
Your Java Options Example:
-Xms 512m
-Xmx 1024m
-Xss256k
-XX:MaxPermSize=256m
-XX:ReservedCodeCacheSize=128m
另外一種方法,利用指令執行
若有大量網頁需求時, 會因記憶體太少, 而導致 Tomcat 當掉無法運作,
所以, 若要應付大量網頁的需求,需增加JVM的記憶體大小如下:
First Calculate the number of threads you can create
(MaxProcessMemory - JVMMemory - ReservedOsMemory) / (ThreadStackSize) = Number of threads
Example:
For Java 1.5 you will get the following results assuming that the OS reserves about 120MB:
1.5GB allocated to JVM: (2GB-1.5Gb-120MB)/(1MB) = ~380 threads
1.0GB allocated to JVM: (2GB-1.0Gb-120MB)/(1MB) = ~880 threads
Your Java Options Example:
-Xms 512m
-Xmx 1024m
-Xss256k
-XX:MaxPermSize=256m
-XX:ReservedCodeCacheSize=128m
另外一種方法,利用指令執行
於cmd下進入/bin
輸入 “tomcat6 //US//Tomcat6 –JvmMs 512 –jvmMx1024”