Partial parameter Description:
-server: Be sure to be the first parameter, good performance on multiple CPUs
-XMS: Initial heap size, minimum memory used, higher CPU performance should be set larger
-xmx:java heap maximum value, maximum memory used
-xx:permsize: Set the permanent storage area of memory
-xx:maxpermsize: Set a permanent save area for maximum memory
-xx:maxnewsize:
+xx:aggressiveheap will make XMS meaningless. This parameter lets the JVM ignore the xmx parameter, eats up a G-physical memory crazily, and then eats up a g swap.
-XSS: Stack size per thread
-VERBOSE:GC Real Garbage Collection information
-xloggc:gc.log Specify garbage collection log files
The heap size of the-xmn:young generation, generally set to one of the 3 and 4 points of xmx
-XX:+USEPARNEWGC: Shorten the time of minor collection
-XX:+USECONCMARKSWEEPGC: Shorten the time of major collection
Tip: This option is more appropriate when the heap size is larger and the major collection time is longer.
Solution to Tomcat's JVM memory overflow problem
1, first is: Java.lang.OutOfMemoryError:Java heap space
Explain:
The JVM heap setting is the setting of the memory space that the JVM can allocate to the Java program while it is running. The JVM automatically sets the value of heap size when it starts, and its initial space (i.e.-XMS) is 1/64 of the physical memory, and the maximum space (-XMX) is 1/4 of the physical memory. You can use options such as the-XMN-XMS-XMX provided by the JVM to set it up. Heap size is the sum of young Generation and tenured generaion.
Tip: This exception message is thrown in the JVM if 98% of the time is for GC and the available heap size is less than 2%.
Tip: Heap Size is not greater than 80% of the available physical memory, typically to set the-XMS and-XMX options to the same, and-xmn to the-XMX value of 1/4.
Solution: Win under
Manually set Heap Size
Modify Tomcat_home/bin/catalina.bat, add the following line to the "echo" Using catalina_base: $CATALINA _base "":
Set java_opts=%java_opts%-server-xms800m-xmx800m-xx:maxnewsize=256m
2, followed by: Java.lang.OutOfMemoryError:PermGen space
Reason:
PermGen space is the full name of permanent Generation spaces, refers to the permanent storage area of memory, this memory is mainly by the JVM storage class and meta information, class in the loader will be placed in the PermGen In space, it differs from the heap region of the class instance (Instance), and GC (garbage Collection) does not clean up permgen spaces during the runtime of the main program, so if you have a class in your application, PermGen space errors are most likely to occur when the Web server makes pre compile for JSPs. If your web app uses a large number of third-party jars that are larger than the JVM default size (4M), this error message is generated.
Solution: Win under
Manually set the MaxPermSize size
Modify Tomcat_home/bin/catalina.bat (catalina.sh under Linux) and add the following line to the "echo" Using catalina_base: $CATALINA _base "":
Set java_opts=%java_opts%-server-xx:permsize=128m-xx:maxpermsize=512m
catalina.sh plus set java_opts= '-xms64-xmx512 ' Invalid solution
Set java_opts= '-xms64-xmx512 '
The above invalid words are written like this:
Declare-x java_opts= "-xms128m-xmx256"
"Declare-x" must be added, or it will be reported as-x directive is invalid,
Also have the following quotes also note that after adding Wq, restart Tomcat, PS Ax after the process of seeing Tomcat will become similar
/opt/jdk1.6.0/bin/java-xms128m-xmx256m-djava.endorsed.dirs=/opt/tomcat/common/e
Under Windows, if you use the console in a way that is done directly by Startup.bat, you can modify the Catalina.bat
Set java_opts=-xms256m-xmx512m
Note that Linux has single quotes under win, and if you add single quotes, Tomcat does not get up.
Some of the following questions
Java-xmx1610m-version
Java-xmx1610m-version
Web-picked Tomcat memory overflow solution
The reason for the
tomcat Memory Overflow is that the Tomcat memory settings in the production environment are not good enough to cause memory overruns. The memory overflow is not the same, of course, the processing is not the same. Here according to the usual situation and related information to carry out a summary. Common will have the following three kinds of situation generally: 1.outofmemoryerror:java heap space 2.outofmemoryerror:permgen spaces 3.outofmemoryerror:unable to C reate new native Thread. The Tomcat memory overflow solution can be used to set the Tomcat JVM parameters in the first two cases where the application itself does not have a memory leak. (-xms-xmx-xx:permsize-xx:maxpermsize) The last one may need to adjust both the operating system and the Tomcat JVM parameters to achieve the goal. The first: Heap overflow. Reason analysis: The JVM heap setting is the setting of the memory space that the JVM can allocate to the Java program while it is running. The JVM automatically sets the value of heap size when it starts, and its initial space (i.e.-XMS) is 1/64 of the physical memory, and the maximum space (-XMX) is 1/4 of the physical memory. You can use options such as the-XMN-XMS-XMX provided by the JVM to set it up. Heap size is the sum of young Generation and tenured generaion. This exception information is thrown in the JVM if 98% of the time is for GC and the available heap size is less than 2%. Heap Size is not greater than 80% of the available physical memory, generally to set the-XMS and-XMX options to the same, and-xmn to the-XMX value of 1/4. If there is no memory leak, the adjustment-xms-xmx parameter can be resolved. -XMS: Initial Heap size-xmx: Maximum heap size |