The two most common configurations of JVM are:
-Xms512m
-Xmx1024m
-XMS sets the JVM's initial memory size.-xmx indicates the maximum memory size. If this value is exceeded, a memory overflow is reported, which causes many causes, it is mainly about the recovery of virtual machines and
Storage leakage. Because the overhead of page application is generated when the value exceeds-XMS, many application servers generally recommend that-XMS and-xmx are equivalent; the maximum value is generally not 75% of the host memory.
Left and right (multiple servers add up the memory). When the JVM is in the recycle state for most of the time and the memory is in a very long and small state for a long time, the following error occurs: Java. Lang. outofmemoryerror: Java.
Heap space error.
JVM memory configurations fall into two categories:
1. Parameter information starting with-X: Generally, each version does not change much.
2. Parameter information starting with-XX: The version upgrade changes a lot. If not, keep the default value.
3. Another special option is "-server" or "-client". There are some minor differences in the default memory configuration. To run a program directly using JDK, the default option is "-client, application Server production mode is normal
Only-server is used.
1. Common configuration information starting with-X:
-Xnoclassgc disables garbage collection. This parameter is not applicable in general.
-Enable incremental garbage collection in xincgc
-The size of the Java heap initialized in the xmn1024k Eden area. The default value is 640 kb.
-Xms512m Java heap initialization size. The default value is 32 MB.
-The maximum size of the xmx512m Java heap. The default size is 64 MB, which generally does not exceed 2 GB. On a 64-bit machine, a 64-bit JVM is used. The operating system needs to perform unlimited to set the size to more than 2 GB.
2. Common memory configuration information starting with-XX:
-XX:-disableexplicitgc ignores the code that calls GC manually, for example, system. GC (). Change-disableexplicitgc to + disableexplicitgc to enable it. The default value is enable.
-XX: + useparallelgc enables parallel collection. multiple CPUs are valid and are not enabled by default.
-XX: + useparnewgc enables parallel collection (not collection), which is also valid for multiple CPUs.
-XX: newsize = 128 M initial size of the new domain.
-XX: maxnewsize = 128 m all newly created objects are in Eden. The default value is 640 K in-client, and the default value in-server is 2 m.
-XX: persize = 64 M: Set the permanent domain initialization size. The default size in Weblogic is 48 m, which is generally enough. You can adjust the size according to the actual situation.
-XX: maxpersize = 64 M: set the maximum size of the permanent domain
In addition, you can also set the settings according to the proportion of the region, and set the thread, cache, page size, and so on.
3. Monitoring Information starting with-XX:
-XX: + gitime: shows the amount of time spent on compiling code. This part is divided into runtime compilation and corresponding machine code time.
-XX: + printgc: prints the basic information of garbage collection.
-XX: + printgctimestamps: print the garbage collection timestamp Information
-XX: + printgcdetails: prints details of garbage collection.
-XX: + traceclassloading
-XX: + traceclassresolution: constant pool for tracking
-XX: + traceclassunloading
Common JVM configurations