Recently I've deployed same WAR to Tomcat server on two machines A and B. On machine A everything works well, but on machine B there are error messages: "java.lang.OutOfMemoryError: Java heap space"
I try to reduce Java heap size on machine A to see if same symptom can be reproduce. After change InitialHeapSize and MaxHeapSize to 128MB, I finally can reproduce same issue on machine A.
I am using Tomcat 7 + Eclipse on machine A, here are some references about how to change the heap size using Eclipse:
http://www.mkyong.com/eclipse/eclipse-tomcat-java-lang-outofmemoryerror-java-heap-space/
http://crunchify.com/how-to-increase-tomcat-heapsize-jvm-heap-in-eclipse-ede/
Important parameters:
-Xms<size> - Set initial Java heap size
-Xmx<size> - Set maximum Java heap size
-Xss<size> - Set java thread stack size
Add new Tomcat server arguments in Eclipse on Machine A:
[-XX:+PrintFlagsFinal]
uintx InitialHeapSize := 262228096 {product} [250MB]
uintx MaxHeapSize := 4196401152 {product} [4002MB]
intx ThreadStackSize = 1024 {pd product}
(means the original MaxHeapSize is about 4002MB)
[-Xms512m -Xmx1024m -XX:+PrintFlagsFinal]
uintx InitialHeapSize := 536870912 {product} [512MB]
uintx MaxHeapSize := 1073741824 {product} [1024MB]
intx ThreadStackSize = 1024 {pd product}
[-Xms128m -Xmx128m -XX:+PrintFlagsFinal]
uintx InitialHeapSize := 134217728 {product} [128MB]
uintx MaxHeapSize := 134217728 {product} [128MB]
intx ThreadStackSize = 1024 {pd product}
I try to reduce Java heap size on machine A to see if same symptom can be reproduce. After change InitialHeapSize and MaxHeapSize to 128MB, I finally can reproduce same issue on machine A.
I am using Tomcat 7 + Eclipse on machine A, here are some references about how to change the heap size using Eclipse:
http://www.mkyong.com/eclipse/eclipse-tomcat-java-lang-outofmemoryerror-java-heap-space/
http://crunchify.com/how-to-increase-tomcat-heapsize-jvm-heap-in-eclipse-ede/
Important parameters:
-Xms<size> - Set initial Java heap size
-Xmx<size> - Set maximum Java heap size
-Xss<size> - Set java thread stack size
Add new Tomcat server arguments in Eclipse on Machine A:
[-XX:+PrintFlagsFinal]
uintx InitialHeapSize := 262228096 {product} [250MB]
uintx MaxHeapSize := 4196401152 {product} [4002MB]
intx ThreadStackSize = 1024 {pd product}
(means the original MaxHeapSize is about 4002MB)
[-Xms512m -Xmx1024m -XX:+PrintFlagsFinal]
uintx InitialHeapSize := 536870912 {product} [512MB]
uintx MaxHeapSize := 1073741824 {product} [1024MB]
intx ThreadStackSize = 1024 {pd product}
[-Xms128m -Xmx128m -XX:+PrintFlagsFinal]
uintx InitialHeapSize := 134217728 {product} [128MB]
uintx MaxHeapSize := 134217728 {product} [128MB]
intx ThreadStackSize = 1024 {pd product}
No comments:
Post a Comment