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 up
example, the following gives reference to the parameter settings of the Java JVM in the 1G memory environment:
Copy Code code as follows:
Java_opts= "-server-xms800m-xmx800m-xx:permsize=64m
-xx:maxnewsize=256m-xx:maxpermsize=128m-djava.awt.headless=true "
Java_opts= "-server-xms768m-xmx768m-xx:permsize=128m
-xx:maxpermsize=256m-xx:newsize=192m-xx:maxnewsize=384m "
Catalina_opts= "-server-xms768m-xmx768m-xx:permsize=128m
-xx:maxpermsize=256m
-xx:newsize=192m-xx:maxnewsize=384m "
Linux:
The catalina.sh in the/usr/local/apache-tomcat-5.5.23/bin directory
Add: java_opts= '-xms512m-xmx1024m '
To add the "M" description is MB, otherwise it is KB, and will report low memory when you start Tomcat.
-XMS: Initial value
-XMX: Max value
-XMN: Minimum value
Windows
Join in front of the Catalina.bat
Copy Code code as follows:
Set java_opts=-xms128m-xmx350m
If you use the Startup.bat startup Tomcat,ok setting to take effect. Allocate 200M memory successfully.
But instead of performing startup.bat to start Tomcat instead of using Windows's system service to start the Tomcat service,
The above settings will not take effect,
That means set java_opts=-xms128m-xmx350m didn't work.
The 200M memory allocated above is oom.
The Windows service executes Bin/tomcat.exe. He reads the values in the registry, not the Catalina.bat settings.
Solution:
Copy Code code as follows:
Modify Registry Hkey_local_machine/software/apache SOFTWARE Foundation
/tomcat Service manager/tomcat5/parameters/javaoptions
The original value is
Copy Code code as follows:
-dcatalina.home= "C:/apachegroup/tomcat 5.0″
-djava.endorsed.dirs= "C:/apachegroup/tomcat 5.0/common/endorsed"
-xrs
Join
Copy Code code as follows:
Restart the Tomcat service, Setup takes effect
(Tomcat 5.5, under the Apache Software Foundation under a procrun 2.0 Tomcat5/parameters/java
Set Jvmms and JVMMX values on it, you want to modify the value of 10.
However, the OS also has limits on memory
Attach: How to obtain the maximum available memory of the JVM
Test with the java-xmxxxxxm-version command at the command line, then gradually increase the value of XXXX, and print the error message if the specified memory size is available if performed normally.
The actual discovery version has a slight difference in the JDK maximum allowable memory value is not the same, so in the actual application or to test their own to see what the value of memory to achieve.
What this table is saying is that if your machine has too much memory, you can only use a few more instances to provide the machine's utilization, such as running Tomcat, you can pack a few more tomcat and do the cluster, and so on.
The results of this family test, I quote here
Corporate JVM version maximum memory (mega) client maximum memory (MB) server
Copy Code code as follows:
SUN 1.5.x 1492 1520
SUN 1.5.5 (Linux) 2634 2660
SUN 1.4.2 1564 1564
SUN 1.4.2 (Linux) 1900 1260
IBM 1.4.2 (Linux) 2047 N/A
BEA JRockit 1.5 (U3) 1909 1902
So the system version of the OS, the JDK version has a lot to do. If you want to make the most of your memory, consider using a cluster.
First, in the Catalina.bat of Tomcat modified, add-dcom.sun.management.jmxremote parameters
Copy Code code as follows:
Set java_opts=%java_opts%-dcom.sun.management.jmxremote
Second, need to use more than jdk5.0, open the bin directory Jconsole.exe, you can connect tracking Tomcat memory usage