TomcatVM parameter modification under Linux

  
is not feasible. Initially I directly modified catalina.sh, added the JAVA_OPTS variable -server -Xms1G -Xmx1G -XX:+UserG1GC It didn't seem to be a problem at first, but when the server was running for a few days, It is found that executing shutdown.sh cannot close tomcat. The error message is as follows: #root@iZ94hjppdqzZ:~/projects/taolijie# cat hs_err_pid5519.log # There is insufficient memory for the Java Runtime Environment to continue. # Native memory allocation (mmap) failed to Map 1073741824 bytes for committing reserved memory. # Possible reasons: # The system is out of physical RAM or swap space # In 32 bit mode, the process size limit was hit # Possible solutions: # Reduce memory load on the system # Increase physical memory Or swap space # Check if swap backing store is full # Use 64 bit Java on a 64 bit OS # Decrease Java heap size (-Xmx/-Xms) # Decrease number of Java threads # Decrease Java thread stack sizes (-X Ss) # Set larger code cache with -XX:ReservedCodeCacheSize= # This output file may be truncated or incomplete. # # Out of Memory Error (os_linux.cpp:2673), pid=5519, tid=3061726064 # # JRE version: ( 8.0_45-b14) (build ) # Java VM: Java HotSpot(TM) Server VM (25.45-b02 mixed mode linux-x86 ) # Failed to write core dump. Core dumps have been disabled. To enable core dumping, try " Ulimit -c unlimited" before starting Java again # Close a tomcat to request 1G of memory, then the server left 200M memory, so Out Of Memory. Look at shutdown.sh and find that it actually calls catalina.sh, just passing in a stop parameter. Catalina.sh executes org.apache.catalina.startup.Bootstrap stop to send shutdown information to tomcat. Since we have set up JAG_OPTS to use 1G heap above, the JVM will apply for more than 1G of memory to the system when it executes this class, which directly leads to Out Of Memory. Possible method Add in the second line of catalina.sh: CATALINA_OPTS="$CATALINA_OPTS -server -Xms1G -Xmx1G -XX:+UseG1GC" These VM parameters will only be applied to catalina instead of all Tomcat processes.zh-CN"],null,[0.96889114],zh-CN"]]]
Copyright © Windows knowledge All Rights Reserved