Tomcat - The Memory Overflow set JAVA_OPTS

Please indicate the source: http: //blog.csdn.net/l1028386804/article/details/52676480

Answer 1
Set initial memory Tomcat start
its initial spatial (i.e. -Xms) 1/64 physical memory, the maximum space (-Xmx) is 1/4 of the physical memory. Can take advantage of -Xmn -Xms -Xmx JVM provide other options can
be set


Three examples, the following parameters are given in Java JVM 1G memory environment is provided with reference to:
the JAVA_OPTS = "- Server -Xms800m -Xmx800m -XX: PermSize -XX = 64M: MaxNewSize -XX = 256M: 128M MaxPermSize = -Djava.awt. = to true headless "
the JAVA_OPTS =" - Server -Xms768m -Xmx768m -XX: PermSize = 128M -XX: MaxPermSize = 256M -XX: 
NewSize = 192M -XX: MaxNewSize = 384M "
CATALINA_OPTS =" - Server -Xms768m -Xmx768m -XX: 128M = -XX PermSize: MaxPermSize = 256M 
-XX: NewSize = 192M -XX: MaxNewSize = 384M "


Linux:
catalina.sh in /usr/local/apache-tomcat-5.5.23/bin directory
to add: JAVA_OPTS = '- Xms512m -Xmx1024m'
to add "m" is the description MB, otherwise the KB, start tomcat when it will be reported out of memory.
-Xms: Initial value
-Xmx: maximum
-Xmn: Min


Windows
in the front to join catalina.bat
set JAVA_OPTS = -Xms128m -Xmx350m 
if you start tomcat, OK with startup.bat set to take effect. 200M memory allocation successful enough.
But if it is not executed startup.bat start tomcat but to use the windows system service start tomcat service, the above settings will not take effect, and
that is set JAVA_OPTS = -Xms128m -Xmx350m did not work. the above 200M of memory allocated on the OOM ..
Windows services are performed bin \ tomcat.exe. he read the registry the value instead catalina.bat settings.
solution:
modify the registry HKEY_LOCAL_MACHINE \ SOFTWARE \ Apache Software Foundation \ Tomcat Service Manager \ Tomcat5 \ Parameters \ JavaOptions
original value
-Dcatalina.home = "C: \ ApacheGroup \ Tomcat 5.0 "
-Djava.endorsed.dirs =" C: \ ApacheGroup \ Tomcat 5.0 \ the Common \ endorsed "
the -Xrs
join -Xms300m -Xmx350m  
restart the tomcat service, set to take effect 

 

Answer 2
solve the problem of Tomcat JVM memory overflow of
keywords: solve the tomcat jvm memory overflow problems of 
recent years has developed a familiar project that requires the database migration from mysql to oracle, jdbc connection point to the first mysql, tomcat packed into the inside, you can run, there is no problem, but when the jdbc connection point to the oracle, tomcat on consecutive throwing errors java.lang.OutOfMemoryError, Internet google a bit to learn about running a tomcat mechanism, but also to solve the problem, share it for future reference.


1, the first is: java.lang.OutOfMemoryError: the Java heap Space 
explained: 
Heap size setting 
JVM heap setting refers to the process of setting .JVM java program running JVM memory space can be used to deploy automatically set Heap size at startup value, the initial space (i.e. -Xms) 1/64 physical memory, the maximum space (-Xmx) is 1/4 of the physical memory. Can take advantage of -Xmn -Xms -Xmx JVM provide other options can be set. Heap size is the size of the Young Generation and Tenured Generaion sum.
Tip: If the JVM when 98% of the time available for the GC Heap size and less than 2% will throw this exception information. 
Tip: Maximum Heap Size should not exceed 80% of the available physical memory, generally want -Xms and -Xmx option is set to the same, and -Xmn for the -Xmx value of 1/4. 
Solution: 
manually set Heap size 
modification TOMCAT_HOME / bin / catalina.bat, the "echo" Using CATALINA_BASE: $ CATALINA_BASE "" above was added the following lines:
the Java code is 
set JAVA_OPTS =% JAVA_OPTS% -server -Xms800m -Xmx800m -XX: MaxNewSize 256M =   
SET = the JAVA_OPTS% -server -Xms800m -Xmx800m the JAVA_OPTS% -XX: MaxNewSize = 256M 
or modify catalina.sh 
In the "echo" Using CATALINA_BASE: $ CATALINA_BASE "" above to add the following lines: 
the JAVA_OPTS = "$ -server -Xms800m -Xmx800m the JAVA_OPTS -XX: MaxNewSize = 256M" 


2, followed by: java.lang.OutOfMemoryError: PermGen space 
reasons: 
PermGen Space full name is the Permanent Generation space, refers to the permanent preservation area of memory, this memory is stored mainly Class and Meta information JVM, Class being Loader when PermGen space will be placed in it and store class instances (instance) Heap of different areas, GC (Garbage Collection) will not be cleaned up PermGen space in the main program run, so if your application has a very cLASS then it is PermGen space errors may occur, this error is common, web server when the JSP to pre compile. If you are under the WEB APP we have spent a lot of third-party jar, whose size exceeds the jvm default size (4M) then it will generate the error message. 
Solution: 
1. Manually set the size MaxPermSize 
modify TOMCAT_HOME / bin / catalina.bat (under Linux is catalina.sh), Java code 
"echo" Using CATALINA_BASE: $ CATALINA_BASE "" above the following line:    
SET% = the JAVA_OPTS the JAVA_OPTS% -XX -server: PermSize = 128M -XX: MaxPermSize = 512M   
"echo" the Using CATALINA_BASE: $ CATALINA_BASE "" above, add the following line: 
set JAVA_OPTS =% JAVA_OPTS% -server -XX  : PermSize = 128M -XX: MaxPermSize = 512m
under catalina.sh as: 
the Java code for 
the JAVA_OPTS = "$ -server the JAVA_OPTS -XX: PermSize = 128M -XX: MaxPermSize = 512M"  
the JAVA_OPTS = "$ JAVA_OPTS -server -XX: PermSize =  128M -XX: MaxPermSize = 512m"
Also see another post, I feel very good, excerpt follows: 
analysis java.lang.OutOfMemoryError: PermGen space 
found that many people due to the problem: spring, hibernate, tomcat, because they are dynamically generated class, resulting in permanent heap JVM overflow. Then solutions different opinions, some say upgrade to the latest version of tomcat or simply do not have tomcat. Others suspect that the problem of spring, very intense discussion, because in the spring using AOP CBLIB dynamically generate a lot of class in the spring forum.
But the question is why the same problem then, it is not the more fundamental causes of these ace open source will happen? Q & A tomcat in a very vague answer this, we know the problem, but the problem is generated by a more fundamental problem.
So someone made a check on the more basic JVM, found the crux of the problem. The JVM SUN the original memory area different points, one of which is used to store permenter with very many classes and described. SUN originally considered when designing this area is fixed at JVM startup time, but now he did not think the dynamic will be so widely used. Moreover, this area has a special mechanism to recover the waste, the question now is dynamically loaded into the class after this region, gc simply no way to recover!
For more than two questions, I deal with are: 
an increase in the first line of catalina.bat: 
the Java code for 
the SET-Xmx256m--Xms64m the JAVA_OPTS = -XX: PermSize = 128M -XX: MaxNewSize = 256M -XX: MaxPermSize = 256M  
the SET the JAVA_OPTS = -Xms64m -Xmx256m -XX: PermSize = 128M -XX: MaxNewSize = 256m -XX: MaxPermSize = 256m
increase in the first line of catalina.sh: 
the Java code for 
the JAVA_OPTS =
-Xms64m 
-Xmx256m- 
-XX: PermSize = 128M 
-XX: = 256M MaxNewSize 
-XX: MaxPermSize = 256M 

Answer 1
Set initial memory Tomcat start
its initial spatial (i.e. -Xms) 1/64 physical memory, the maximum space (-Xmx) is 1/4 of the physical memory. Can take advantage of -Xmn -Xms -Xmx JVM provide other options can
be set


Three examples, the following parameters are given in Java JVM 1G memory environment is provided with reference to:
the JAVA_OPTS = "- Server -Xms800m -Xmx800m -XX: PermSize -XX = 64M: MaxNewSize -XX = 256M: 128M MaxPermSize = -Djava.awt. = to true headless "
the JAVA_OPTS =" - Server -Xms768m -Xmx768m -XX: PermSize = 128M -XX: MaxPermSize = 256M -XX: 
NewSize = 192M -XX: MaxNewSize = 384M "
CATALINA_OPTS =" - Server -Xms768m -Xmx768m -XX: 128M = -XX PermSize: MaxPermSize = 256M 
-XX: NewSize = 192M -XX: MaxNewSize = 384M "


Linux:
catalina.sh in /usr/local/apache-tomcat-5.5.23/bin directory
to add: JAVA_OPTS = '- Xms512m -Xmx1024m'
to add "m" is the description MB, otherwise the KB, start tomcat when it will be reported out of memory.
-Xms: Initial value
-Xmx: maximum
-Xmn: Min


Windows
in the front to join catalina.bat
set JAVA_OPTS = -Xms128m -Xmx350m 
if you start tomcat, OK with startup.bat set to take effect. 200M memory allocation successful enough.
But if it is not executed startup.bat start tomcat but to use the windows system service start tomcat service, the above settings will not take effect, and
that is set JAVA_OPTS = -Xms128m -Xmx350m did not work. the above 200M of memory allocated on the OOM ..
Windows services are performed bin \ tomcat.exe. he read the registry the value instead catalina.bat settings.
solution:
modify the registry HKEY_LOCAL_MACHINE \ SOFTWARE \ Apache Software Foundation \ Tomcat Service Manager \ Tomcat5 \ Parameters \ JavaOptions
original value
-Dcatalina.home = "C: \ ApacheGroup \ Tomcat 5.0 "
-Djava.endorsed.dirs =" C: \ ApacheGroup \ Tomcat 5.0 \ the Common \ endorsed "
the -Xrs
join -Xms300m -Xmx350m  
restart the tomcat service, set to take effect 

 

Answer 2
solve the problem of Tomcat JVM memory overflow of
keywords: solve the tomcat jvm memory overflow problems of 
recent years has developed a familiar project that requires the database migration from mysql to oracle, jdbc connection point to the first mysql, tomcat packed into the inside, you can run, there is no problem, but when the jdbc connection point to the oracle, tomcat on consecutive throwing errors java.lang.OutOfMemoryError, Internet google a bit to learn about running a tomcat mechanism, but also to solve the problem, share it for future reference.


1, the first is: java.lang.OutOfMemoryError: the Java heap Space 
explained: 
Heap size setting 
JVM heap setting refers to the process of setting .JVM java program running JVM memory space can be used to deploy automatically set Heap size at startup value, the initial space (i.e. -Xms) 1/64 physical memory, the maximum space (-Xmx) is 1/4 of the physical memory. Can take advantage of -Xmn -Xms -Xmx JVM provide other options can be set. Heap size is the size of the Young Generation and Tenured Generaion sum.
Tip: If the JVM when 98% of the time available for the GC Heap size and less than 2% will throw this exception information. 
Tip: Maximum Heap Size should not exceed 80% of the available physical memory, generally want -Xms and -Xmx option is set to the same, and -Xmn for the -Xmx value of 1/4. 
Solution: 
manually set Heap size 
modification TOMCAT_HOME / bin / catalina.bat, the "echo" Using CATALINA_BASE: $ CATALINA_BASE "" above was added the following lines:
the Java code is 
set JAVA_OPTS =% JAVA_OPTS% -server -Xms800m -Xmx800m -XX: MaxNewSize 256M =   
SET = the JAVA_OPTS% -server -Xms800m -Xmx800m the JAVA_OPTS% -XX: MaxNewSize = 256M 
or modify catalina.sh 
In the "echo" Using CATALINA_BASE: $ CATALINA_BASE "" above to add the following lines: 
the JAVA_OPTS = "$ -server -Xms800m -Xmx800m the JAVA_OPTS -XX: MaxNewSize = 256M" 


2, followed by: java.lang.OutOfMemoryError: PermGen space 
reasons: 
PermGen Space full name is the Permanent Generation space, refers to the permanent preservation area of memory, this memory is stored mainly Class and Meta information JVM, Class being Loader when PermGen space will be placed in it and store class instances (instance) Heap of different areas, GC (Garbage Collection) will not be cleaned up PermGen space in the main program run, so if your application has a very cLASS then it is PermGen space errors may occur, this error is common, web server when the JSP to pre compile. If you are under the WEB APP we have spent a lot of third-party jar, whose size exceeds the jvm default size (4M) then it will generate the error message. 
Solution: 
1. Manually set the size MaxPermSize 
modify TOMCAT_HOME / bin / catalina.bat (under Linux is catalina.sh), Java code 
"echo" Using CATALINA_BASE: $ CATALINA_BASE "" above the following line:    
SET% = the JAVA_OPTS the JAVA_OPTS% -XX -server: PermSize = 128M -XX: MaxPermSize = 512M   
"echo" the Using CATALINA_BASE: $ CATALINA_BASE "" above, add the following line: 
set JAVA_OPTS =% JAVA_OPTS% -server -XX  : PermSize = 128M -XX: MaxPermSize = 512m
under catalina.sh as: 
the Java code for 
the JAVA_OPTS = "$ -server the JAVA_OPTS -XX: PermSize = 128M -XX: MaxPermSize = 512M"  
the JAVA_OPTS = "$ JAVA_OPTS -server -XX: PermSize =  128M -XX: MaxPermSize = 512m"
Also see another post, I feel very good, excerpt follows: 
analysis java.lang.OutOfMemoryError: PermGen space 
found that many people due to the problem: spring, hibernate, tomcat, because they are dynamically generated class, resulting in permanent heap JVM overflow. Then solutions different opinions, some say upgrade to the latest version of tomcat or simply do not have tomcat. Others suspect that the problem of spring, very intense discussion, because in the spring using AOP CBLIB dynamically generate a lot of class in the spring forum.
But the question is why the same problem then, it is not the more fundamental causes of these ace open source will happen? Q & A tomcat in a very vague answer this, we know the problem, but the problem is generated by a more fundamental problem.
So someone made a check on the more basic JVM, found the crux of the problem. The JVM SUN the original memory area different points, one of which is used to store permenter with very many classes and described. SUN originally considered when designing this area is fixed at JVM startup time, but now he did not think the dynamic will be so widely used. Moreover, this area has a special mechanism to recover the waste, the question now is dynamically loaded into the class after this region, gc simply no way to recover!
For more than two questions, I deal with are: 
an increase in the first line of catalina.bat: 
the Java code for 
the SET-Xmx256m--Xms64m the JAVA_OPTS = -XX: PermSize = 128M -XX: MaxNewSize = 256M -XX: MaxPermSize = 256M  
the SET the JAVA_OPTS = -Xms64m -Xmx256m -XX: PermSize = 128M -XX: MaxNewSize = 256m -XX: MaxPermSize = 256m
increase in the first line of catalina.sh: 
the Java code for 
the JAVA_OPTS =
-Xms64m 
-Xmx256m- 
-XX: PermSize = 128M 
-XX: = 256M MaxNewSize 
-XX: MaxPermSize = 256M 

Guess you like

Origin www.cnblogs.com/eos666/p/11140672.html
Recommended