These options from the JVM: Xms/xmx/permsize/maxpermsize can involve a number of problems, such as performance tuning.
Description: The following reprint has not been practiced.
Example of experience (reference):
Sets the stack size for each thread. After JDK5.0, each thread has a stack size of 1M, before each thread has a stack size of 256K. The size of the memory required for the more applied threads to be adjusted. In the same physical memory, reducing this value can generate more threads. However, the operating system of the number of threads within a process is still limited, can not be generated indefinitely, the empirical value of 3000~5000 around.
The meaning of the parameter:
- -vmargs-xms128m-xmx512m-xx:permsize=64m-xx:maxpermsize=128m
- -vmargs: description is followed by the parameters of the VM, so the following are actually the parameters of the JVM
- -xms128m: Heap memory initially allocated by the JVM
- -xmx512m: JVM Maximum allowable allocated heap memory, on demand
- -xx:permsize=64m: Non-heap memory initially allocated by the JVM
- -xx:maxpermsize=128m: JVM maximum allowable allocated non-heap memory, on demand
VM Memory Management Mechanisms:
1, heap, and non-heap (non-heap) memory
According to the official statement, "Java virtual machines have a heap, the heap is a runtime data region, and all class instances and arrays of memory are allocated from here." The heap is created when the Java Virtual machine is started. "," the memory outside the heap in the JVM is called Non-heap memory (Non-heap memories) ".
You can see that the JVM primarily manages two types of memory: heap and non-heap. In a nutshell, a heap is a Java code-readable memory that is left to the developer, not a heap, which is left to itself by the JVM, so the method area, the JVM internally processes or optimizes the required memory (such as the JIT-compiled code cache), each class structure (such as running a constant pool, field, and method data) And the code for methods and construction methods are in non-heap memory.
1.1. Heap memory allocation
The initial allocated heap memory of the JVM is specified by-XMS, and the default is the maximum allocated heap memory for 1/64;JVM of physical memory specified by-XMX, which defaults to 1/4 of the physical memory. When the default free heap memory is less than 40%, the JVM will increase the heap until the maximum limit of-xmx;
When free heap memory is greater than 70%, the JVM will reduce the heap until the minimum limit of-XMS. So the server generally sets-xms,-xmx equal to avoid resizing the heap after each GC.
Note: If-XMX is not specified or is small, the application may cause a java.lang.OutOfMemory error, which is from the JVM, not throwable, and cannot be captured with Try...catch.
1.2. Non-heap memory allocation
The JVM uses-xx:permsize to set the non-heap memory initial value, which defaults to 1/64 of the physical memory, and the maximum non-heap memory by Xx:maxpermsize, which by default is 1/4 of physical memory. (There is also a saying: the maxpermsize default is related to the-server-client option, the default 64m,-client under the-server option is maxpermsize option is 32m.) I don't have an experiment with this. )
The full name of the PermGen space in the above error message is permanent Generation space, which is the permanent storage area of the memory. It is not clear whether PermGen space is a non-heap memory, or is not a heap of memory, but at least it belongs to.
Xx:maxpermsize set too small will cause java.lang.OutOfMemoryError:PermGen space is memory benefits.
Tell me why memory benefits:
- This part of memory is used to store class and meta information, and class is placed in the PermGen space area when it is loaded, unlike the heap area where the instance is stored.
- The GC (garbage Collection) does not clean up permgen space during the main program's run time, so if your app will load many classes, you will likely have permgen space errors. This error is common when the Web server pre-compile the JSP.
2. JVM memory limit (maximum)
First, the JVM memory is limited to the actual maximum physical memory, assuming that the physical memory is infinitely large, the maximum value of the JVM memory is very much related to the operating system. In short, the 32-bit processor, although the controllable memory space has 4GB, but the specific operating system will give a limit, This limit is generally 2GB-3GB (typically under Windows systems for the 1.5g-2g,linux system 2g-3g), and processors over 64bit are not limited.
Why do some machines I set-xmx and-xx:maxpermsize to 512M after eclipse can be started, and some machines will not boot?
We have learned from the above introduction to JVM memory management that there are two types of JVM memory: heap memory and non-heap memory, and the JVM's maximum memory depends first on actual physical memory and operating system. So there are several reasons why setting a VM parameter causes the program to fail to start:
- The value of-XMS in the parameter is greater than-XMX, or the value of-xx:permsize is greater than-xx:maxpermsize;
- The sum of-XMX values and-xx:maxpermsize exceeds the maximum limit of JVM memory, such as the maximum memory limit of the current operating system, or actual physical memory, and so on. When it comes to physical memory, it is important to note that if your memory is 1024MB, the actual system is not likely to be 1024MB, because a portion of it is consumed by the hardware.
3. Heap Size setting
The maximum heap size in the JVM has three limitations: the data Model (32-BT or 64-bit) of the associated operating system, the system's available virtual memory limits, and the available physical memory limits for the system. Under the 32-bit system, the 1.5g~2g;64 is generally limited to memory unrestricted for the operating system. I test under Windows Server 2003 System, 3.5G physical memory, JDK5.0, Max can be set to 1478m.
3.1. Typical settings:
3.1.1,java -xmx3550m-xms3550m-xmn2g-xss128k
- - xmx3550m: Sets the maximum available memory for the JVM to 3550M.
- -xms3550m: Set the JVM to drive memory to 3550m. This value can be set to the same as-xmx to avoid the JVM reallocating memory after each garbage collection completes.
- -xmn2g: Set the young generation size to 2G. the entire JVM memory size = younger generation size + old generation size + persistent generation size. The permanent average fixed size is 64m, so increasing the younger generation will reduce the size of older generations. This value has a large impact on system performance, and Sun's official recommendation is 3/8 for the entire heap.
- -xss128k: Sets the stack size for each thread. After JDK5.0, each thread has a stack size of 1M, before each thread has a stack size of 256K. The size of the memory required for the more applied threads to be adjusted. In the same physical memory, reducing this value can generate more threads. However, the operating system of the number of threads within a process is still limited, can not be generated indefinitely, the empirical value of 3000~5000 around.
3.1.2,java-xmx3550m-xms3550m-xss128k -xx:newratio=4-xx:survivorratio=4-xx:maxpermsize=16m-xx: Maxtenuringthreshold=0
- -xx:newratio=4: Sets the ratio of the young generation (including Eden and the two survivor zone) to the old generation (except for the persistent generation). Set to 4, the ratio of the young generation to the old generation is 1:4, and the younger generation takes up 1/5 of the entire stack.
- -xx:survivorratio=4: Sets the ratio of the size of Eden and survivor in the younger generation. Set to 4, the ratio of two survivor to one Eden area is 2:4, and a survivor area represents 1/6 of the entire young generation.
- -xx:maxpermsize=16m: Set the persistent generation size to 16m.
- -xx:maxtenuringthreshold=0: Sets the maximum age for garbage. if set to 0, then the young generation object does not go through the survivor area, directly into the old generation . For older generations of more applications, can improve efficiency. If this value is set to a larger value, the younger generation objects are duplicated multiple times in the Survivor area, which increases the survival time of the object's younger generations , increasing the introduction of being recycled in the younger generation.
4. Selection of the Collector
The JVM gives three choices: the serial collector, the parallel collector, the concurrent collector , but the serial collector is only available for small amounts of data, so the choice here is primarily for the parallel collector and the concurrency collector. By default, JDK5.0 used a serial collector before, and if you want to use a different collector, you need to add the appropriate parameters at startup. After JDK5.0, the JVM is judged based on the current system configuration.
4.1, throughput-first parallel collector
As mentioned above, the parallel collector is mainly aimed at reaching a certain throughput, and is suitable for science and technology and background processing.
4.1.1, typical configuration :
4.1.1.1,java-xmx3800m-xms3800m-xmn2g-xss128k -xx:+useparallelgc-xx:parallelgcthreads=20
- -XX:+USEPARALLELGC: Select the garbage collector as the parallel collector. This configuration is only valid for younger generations. In this configuration, the younger generation uses concurrent collection, while the older generation still uses serial collection.
- -xx:parallelgcthreads=20: Configures the number of threads for a parallel collector, that is, how many threads are garbage collected together. This value is best configured to be equal to the number of processors.
4.1.1.2,java-xmx3550m-xms3550m-xmn2g-xss128k-xx:+useparallelgc-xx:parallelgcthreads=20 -XX:+ USEPARALLELOLDGC
- -XX:+USEPARALLELOLDGC: Configure the old Generation garbage collection method for parallel collection. JDK6.0 supports parallel collection of older generations.
4.1.1.3,java-xmx3550m-xms3550m-xmn2g-xss128k-xx:+useparallelgc -xx:maxgcpausemillis=100
- -xx:maxgcpausemillis=100 : Sets the maximum time for each young generation of garbage collection, and if this time is not met, the JVM automatically adjusts the younger generation size to meet this value.
4.1.1.4,java-xmx3550m-xms3550m-xmn2g-xss128k-xx:+useparallelgc-xx:maxgcpausemillis=100 -XX:+ Useadaptivesizepolicy
- -xx:+useadaptivesizepolicy: When this option is set, the parallel collector automatically selects the size of the younger generation and the corresponding Survivor area scale to achieve the minimum corresponding time specified by the target system or the collection frequency, etc. This value is recommended when using the parallel collector and is always turned on.
4.2, Response time-first concurrency collector
As mentioned above, the concurrency collector is mainly to ensure the response time of the system, reduce the time of the garbage collection downtime. It is suitable for application server, telecom field and so on.
4.2.1, typical configuration :
4.2.1.1,java-xmx3550m-xms3550m-xmn2g-xss128k-xx:parallelgcthreads=20 -xx:+useconcmarksweepgc-xx:+ USEPARNEWGC
- -XX:+USECONCMARKSWEEPGC: Set old age on behalf of concurrent collection. After configuring this in the test, the configuration of the-xx:newratio=4 is invalid for unknown reasons. Therefore, at this time the younger generation size is best set with-XMN.
- -XX:+USEPARNEWGC: Set Young on behalf of the parallel collection. Can be used concurrently with CMS collection. JDK5.0 above, the JVM will set itself according to the system configuration, so it is no longer necessary to set this value.
4.2.1.2,java-xmx3550m-xms3550m-xmn2g-xss128k-xx:+useconcmarksweepgc -xx:cmsfullgcsbeforecompaction =5-xx:+usecmscompactatfullcollection
- -xx:cmsfullgcsbeforecompaction: Because the concurrent collector does not compress and defragment the memory space, it can produce "fragmentation" after a period of time, which makes the operation less efficient. This value sets how many times a GC is run to compress and defragment the memory space.
- -xx:+usecmscompactatfullcollection: Turn on compression for older generations. Performance may be affected, but fragmentation can be eliminated
4.3. Auxiliary information
The JVM provides a number of command-line arguments to print information for debugging purposes. There are mainly the following:
4.3.1,-XX:+PRINTGC
Output form :
[GC 118250k->113543k (130112K), 0.0094143 secs]
[Full GC 121376k->10414k (130112K), 0.0650971 secs]
4.3.2,-xx:+printgcdetails
Output form :
[GC [defnew:8614k->781k (9088K), 0.0123035 secs] 118250k->113543k (130112K), 0.0124633 secs]
[GC [defnew:8614k->8614k (9088K), 0.0000665 secs][tenured:112761k->10414k (121024K), 0.0433488 secs] 121376k- >10414k (130112K), 0.0436268 secs]
4.3.3,-xx:+printgctimestamps -xx:+printgc:printgctimestamps can be mixed with the above two
Output form:
11.851: [GC 98328k->93620k (130112K), 0.0082960 secs]
4.3.4,-xx:+printgcapplicationconcurrenttime: The execution time of the program is not interrupted before each garbage collection is printed. Can be mixed with the above
Output form:
Application time:0.5291524 seconds
4.3.5,-xx:+printgcapplicationstoppedtime: The time the program was paused during the print garbage collection. Can be mixed with the above
Output form:
Total time for which application threads were stopped:0.0468229 seconds
4.3.6,-XX:PRINTHEAPATGC: detailed stack information before and after printing GC
Output form:
34.702: [GC {HEAP before GC invocations=7: def New generation Total 55296K, used 52568K [0x1ebd0000, 0x227d0000, 0x227d0000)Eden Space 49152K, 99% used [0x1ebd0000, 0x21bce430, 0x21bd0000)From space 6144K, 55% used [0x221d0000, 0x22527e10, 0x227d0000)To space 6144K, 0% used [0x21bd0000, 0x21bd0000, 0x221d0000)tenured generation Total 69632K, used 2696K [0x227d0000, 0x26bd0000, 0x26bd0000)The space 69632K, 3% used [0x227d0000, 0x22a720f8, 0x22a72200, 0x26bd0000)Compacting Perm Gen Total 8192K, used 2898K [0x26bd0000, 0x273d0000, 0x2abd0000)The space 8192K, 35% used [0x26bd0000, 0x26ea4ba8, 0X26EA4C00, 0x273d0000)ro Space 8192K, 66% used [0x2abd0000, 0X2B12BCC0, 0x2b12be00, 0x2b3d0000)RW Space 12288K, 46% used [0x2b3d0000, 0x2b972060, 0x2b972200, 0x2bfd0000) 34.735: [defnew:52568k->3433k (55296K), 0.0072126 secs] 552 64k->6615k (124928K) Heap after GC invocations=8: def New generation Total 55296K, used 3433K [0x1ebd0000, 0x227d0000, 0x227d0000)Eden Space 49152K, 0% used [0x1ebd0000, 0x1ebd0000, 0x21bd0000)From space 6144K, 55% used [0x21bd0000, 0x21f2a5e8, 0x221d0000)To space 6144K, 0% used [0x221d0000, 0x221d0000, 0x227d0000)tenured generation Total 69632K, used 3182K [0x227d0000, 0x26bd0000, 0x26bd0000)The space 69632K, 4% used [0x227d0000, 0x22aeb958, 0x22aeba00, 0x26bd0000)Compacting Perm Gen Total 8192K, used 2898K [0x26bd0000, 0x273d0000, 0x2abd0000)The space 8192K, 35% used [0x26bd0000, 0x26ea4ba8, 0X26EA4C00, 0x273d0000)ro Space 8192K, 66% used [0x2abd0000, 0X2B12BCC0, 0x2b12be00, 0x2b3d0000)RW Space 12288K, 46% used [0x2b3d0000, 0x2b972060, 0x2b972200, 0x2bfd0000)}, 0.0757599 secs]
4.3.7,-xloggc:filename: In conjunction with the above, the relevant log information is recorded to the file for analysis.
5. Common Configuration Summary
5.1. Heap Settings
- -xms: initial heap Size
- -xmx: Maximum heap Size
- -xx:newsize=n: Setting the young generation size
- -xx:newratio=n: Sets the ratio of the younger generation to the older generation. such as: 3, the ratio of the young generation and the old generation is 1:3, the young generation of the entire young generation of old generation and 1/4
- -xx:survivorratio=n: The ratio of Eden in the young generation to the two survivor districts. Note that there are two survivor districts. such as: 3, indicating Eden:survivor=3:2, a Survivor area accounted for the entire young generation of 1/5
- -xx:maxpermsize=n: Setting the persistent generation size
5.2. Collector Settings
- -XX:+USESERIALGC: Setting up the serial collector
- -XX:+USEPARALLELGC: Setting up a parallel collector
- -XX:+USEPARALLEDLOLDGC: Setting up a parallel old generation collector
- -XX:+USECONCMARKSWEEPGC: Setting the concurrency Collector
5.3. Garbage collection Statistic information
- -xx:+printgc
- -xx:+printgcdetails
- -xx:+printgctimestamps
- -xloggc:filename
5.4. Parallel collector settings
- -xx:parallelgcthreads=n: Sets the number of CPUs to use when the parallel collector is collected. The number of parallel collection threads.
- -xx:maxgcpausemillis=n: Set maximum pause time for parallel collection
- -xx:gctimeratio=n: Sets the percentage of time that garbage collection takes to run the program. The formula is 1/(1+n)
5.5. Concurrent Collector Settings
- -xx:+cmsincrementalmode: Set to incremental mode. Applies to single CPU conditions.
- -xx:parallelgcthreads=n: Set the concurrency collector the number of CPUs used by the young generation collection method for parallel collection. The number of parallel collection threads.
6. Summary of tuning
6.1, Young generation size choice
- Response Time-First application : as large as possible until the minimum response time limit of the system is approached (depending on the actual situation). In such cases, the frequency at which the young generation collects occurs is also minimal. At the same time, reduce the reach of older generations of objects.
- throughput-First application : as large as possible, may reach Gbit degree. Because there is no requirement for response time, garbage collection can be done in parallel, generally suitable for applications over 8CPU.
6.2, the elder generation size choice
6.2.1, Response time-first application : Older generations use the concurrent collector, so the size needs to be carefully set, generally to consider the concurrent session rate and the duration of the session and other parameters. If the heap setting is small, it can result in memory fragmentation, high recovery frequency, and application pauses using traditional markup cleanup, and if the heap is large, a longer collection time is required. The most optimized scenario is generally referred to the following data:
- Concurrent garbage Collection Information
- Persistent generation concurrent Collection times
- Traditional GC Information
- The proportion of time spent in the collection of young and old generations
Reducing the time spent by younger generations and older generations generally increases the efficiency of the application.
6.2.2, throughput-First applications : General throughput priority applications have a very large young generation and a smaller old generation. The reason for this is that the majority of short-term objects can be recovered as much as possible, reducing medium-term objects, while older generations store long-lived objects.
6.3. Fragmentation problems caused by smaller heaps
The heap is not compressed because the old generation of concurrent collectors uses tags and clears the algorithm. When the collector recycles, he merges the adjacent space so that it can be assigned to a larger object. However, when the heap space is small, after a period of time, "fragmentation" occurs, if the concurrent collector does not find enough space, then the concurrent collector will stop, and then use the traditional token, purging method for recycling. If "Fragmentation" occurs, you may need to configure the following:
- -xx:+usecmscompactatfullcollection: When using the concurrency collector, the compression of older generations is turned on.
- -xx:cmsfullgcsbeforecompaction=0: When the above configuration is on, how many times the full GC is set, the old generation is compressed
7. Tuning examples
Environment LINUXAS4,RESIN2.1.17,JDK6.0,2CPU,4G Memory, dell2950 server.
7.1, JVM tuning of serial garbage collection
This is the default configuration, which takes 153 seconds to complete 100,000 request. The JVM parameters are configured as follows:
$JAVA _args.= "-dresin.home= $SERVER _root-server -xms2048m-xmx2048m-xmn512m-xx:permsize=256m-xx: maxpermsize=256m-xx:maxtenuringthreshold=7-xx:gctimeratio=19-xnoclassgc-xloggc:log/gc.log-xx:+ Printgcdetails-xx:+printgctimestamps";
This configuration is generally within 24 hours of resin startup does not seem to be a major problem, the site can be accessed normally, but the view log found that in nearly 24 hours, fullgc execution more and more frequently, about every 3 minutes there is a FULLGC, each FULLGC system will pause for about 6 seconds, As a Web site, the user waiting for 6 seconds is probably too long, so this approach needs to be improved. Maxtenuringthreshold=7 indicates that an object that is moved 7 times in the rescue space has not yet been recycled into the old generation, gctimeratio=19 that Java can use 5% of the time to do garbage collection, 1/(1+19) =1/20=5%.
7.2. Parallel recovery of JVM tuning
Complete 100,000 request spents 117 seconds, configured as follows:
$JAVA _args.= "-dresin.home= $SERVER _root-server-xmx2048m -xms2048m-xmn512m-xx:permsize=256m-xx: Maxpermsize=256m-xnoclassgc-xloggc:log/gc.log-xx:+printgcdetails -xx:+printgctimestamps-xx:+ useparallelgc-xx:parallelgcthreads=20-xx:+useparalleloldgc-xx:maxgcpausemillis=500-xx:+ Useadaptivesizepolicy-xx:maxtenuringthreshold=7-xx:gctimeratio=19";
Parallel recycling I tried a variety of combination configurations, it doesn't seem to work, resin start 3 hours or so will be paused, time more than 10 seconds. It is also possible that the parameter setting is not good enough, Maxgcpausemillis represents the GC maximum pause time, the system is normal when the resin has not been executed FULLGC, but once the execution Fullgc,maxgcpausemillis is not used at all, The pause time may be more than 20 seconds, after what will happen I no longer care, hurriedly restart resin, try other recycling strategy.
7.3. Concurrent recovery of JVM tuning
Completing the 100,000 request takes 60 seconds, which is almost twice as fast as a parallel collection, and is 2.5 times times the performance of the default Recycle policy, configured as follows:
$JAVA _args.= "-dresin.home= $SERVER _root-server -xms2048m-xmx2048m-xmn512m-xx:permsize=256m-xx: MAXPERMSIZE=256M-XX:+USECONCMARKSWEEPGC -xx:maxtenuringthreshold=7-xx:gctimeratio=19-xnoclassgc-xloggc:log /gc.log-xx:+printgcdetails -xx:+printgctimestamps-xx:+usecmscompactatfullcollection -XX: Cmsfullgcsbeforecompaction=0
Although this configuration will not occur 10 seconds, but the system restarts about 3 hours, every few minutes there will be 5 seconds not even in the case, Looking at Gc.log, we found that there was a promotionfailed error in executing PARNEWGC, which turned to the execution FULLGC, causing the system to stall and be frequent, once every few minutes, so it was improved. Usecmscompactatfullcollection is the table is the execution of FULLGC after the memory is compressed, so as not to produce memory fragmentation, cmsfullgcsbeforecompaction=n represents the execution of n FULLGC after memory compression.
7.4, the JVM tuning incremental recovery
Complete 100,000 request time 171 seconds, too slow, configured as follows:
$JAVA _args.= "-dresin.home= $SERVER _root-server -xms2048m-xmx2048m-xmn512m-xx:permsize=256m-xx: Maxpermsize=256m-xx:maxtenuringthreshold=7-xx:gctimeratio=19-xnoclassgc-xloggc:log/gc.log -XX:+ PRINTGCDETAILS-XX:+PRINTGCTIMESTAMPS-XINCGC
It seems that recycling is not too clean, but also has a big impact on performance, not worth trying.
7.5. I-cms mode for JVM tuning concurrent Recovery
As with incremental recovery, it takes 170 seconds to complete 100,000 request. The configuration is as follows:
$JAVA _args.= "-dresin.home= $SERVER _root-server -xms2048m-xmx2048m-xmn512m-xx:permsize=256m-xx: Maxpermsize=256m-xx:maxtenuringthreshold=7-xx:gctimeratio=19-xnoclassgc-xloggc:log/gc.log -XX:+ Printgcdetails-xx:+printgctimestamps -xx:+useconcmarksweepgc-xx:+cmsincrementalmode -XX:+ Cmsincrementalpacing -xx:cmsincrementaldutycyclemin=0-xx:cmsincrementaldutycycle=10-xx:- Traceclassunloading
The use of sun recommended parameters, recovery effect is not good, so there is a pause, within a few hours will be frequent pauses, what sun recommended parameters, so it does not work.
7.6, the JVM tuning of the incremental low-pause collector
What is it called? Train recycling, complete 100,000 request spents 153 seconds, configured as follows:
$JAVA _args.= "-dresin.home= $SERVER _root-server -xms2048m-xmx2048m-xmn512m-xx:permsize=256m-xx: Maxpermsize=256m-xx:maxtenuringthreshold=7-xx:gctimeratio=19-xnoclassgc-xloggc:log/gc.log -XX:+ PRINTGCDETAILS-XX:+PRINTGCTIMESTAMPS-XX:+USETRAINGC
This configuration effect is not good, affect performance, so did not try.
7.7, in contrast, or concurrent recovery is good, high performance, as long as can solve PARNEWGC (parallel recovery young Generation) when the promotionfailed error is all good to do, check a lot of articles, found that the cause of the promotionfailed error is that the CMS is too late to recycle (CMS by default in the old generation accounted for about 90% to execute), the old generation did not have enough space for the GC to move some living objects from the young generation to the old generation, so the implementation of FULLGC. Cmsinitiatingoccupancyfraction=70 says that when the old generation takes up about 70%, it starts executing the CMS, so there is no FULLGC. SOFTREFLRUPOLICYMSPERMB This parameter is also I think more useful, I think there is no need to wait 1 seconds, so set to 0. Configured as follows
$JAVA _args.= "-dresin.home= $SERVER _root-server-xms2048m -xmx2048m-xmn512m-xx:permsize=256m-xx: maxpermsize=256m-xx:survivorratio=8-xx:maxtenuringthreshold=7-xx:gctimeratio=19-xnoclassgc-xx:+ DISABLEEXPLICITGC -xx:+useparnewgc-xx:+useconcmarksweepgc -xx:+cmspermgensweepingenabled -XX:+ Usecmscompactatfullcollection -xx:cmsfullgcsbeforecompaction=0-xx:+cmsclassunloadingenabled-xx:- cmsparallelremarkenabled -xx:cmsinitiatingoccupancyfraction=70-xx:softreflrupolicymspermb=0-xx:+ Printclasshistogram -xx:+printgcdetails-xx:+printgctimestamps -xx:+printgcapplicationconcurrenttime -xx:+printgcapplicationstoppedtime -xloggc:log/gc.log
Above this configuration memory rise very slow, 24 hours almost no pauses, the longest only stalled 0.8S,PARNEWGC every 30 seconds or so to execute once, each recovery about 0.2 seconds, it seems that the problem should be temporarily resolved.
Parameters do not understand the Internet can be checked, I think the more important parameters are:
-xms-xmx-xmnmaxtenuringthresholdgctimeratiouseconcmarksweepgccmsinitiatingoccupancyfractionsoftreflrupolicymspermbecl Configuring JVM parameters in Ipse:-xmx1024m-xms1000m-server-xx:P ermsize=64m-xx: MaxPermSize=128m
Reference:
http://technique-digest.iteye.com/blog/1123046 (The above sections are transferred from this article)
Http://www.360doc.com/content/15/0330/12/16782314_459269672.shtml (the above part of the content is transferred from this article)
http://www.51testing.com/html/80/n-862780.html (JVM parameter tuning to solve the problem of GC recovery lag)
Http://www.importnew.com/15934.html (Why does the JVM consume less memory after specifying the-XMX parameter?) )
Http://www.cnblogs.com/chengxin1982/p/3818448.html
http://unixboy.iteye.com/blog/174173 (The above sections are transferred from this article)
Http://www.cnblogs.com/koik/p/4452029.html
http://cxh61207.iteye.com/blog/1160663
Http://blog.chinaunix.net/uid-26602509-id-4110150.html (Tomcat memory tuning)
http://blog.csdn.net/zhushuai1221/article/details/51027024
Http://developer.51cto.com/art/201201/312639.htm (Tuning special channel)
Http://developer.51cto.com/art/201009/227848_all.htm (JVM Tuning instance, the above part of the content is transferred from this article)
Http://www.cnblogs.com/zhguang/p/Java-JVM-GC.html
http://uule.iteye.com/blog/2114697
Http://blog.sina.com.cn/s/blog_3f12afd00100zpvf.html
http://yjph83.iteye.com/blog/2108105
Java JVM Virtual machine option xms/xmx/permsize/maxpermsize (RPM)