Start docker to solve the high memory usage of jenkins

 Add parameters to the following module, because it is started by docker, so it is inconsistent with other blog solutions

environment:

JAVA_OPTS : "-server -Xms1024m -Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=512m"

JAVA_OPTS, as the name suggests, is a variable used to set JVM-related operating parameters.

JVM:JAVA_OPTS =“ - server -Xms2048m -Xmx2048m -Xss512k”

-server: must be used as the first parameter, which has good performance when using multiple CPUs
-Xms: initial heap size, the minimum memory used, and this value should be set larger when the CPU performance is high
-Xmx: Java? heap maximum value, Use -XX: PermSize: Set the permanent storage area of ​​memory -XX: MaxPermSize: Maximum memory The
above two values ​​are the minimum and maximum memory allocated to the JVM, depending on the size of the hardware physical memory, it is recommended to set them to half of the physical memory. Set the permanent storage area of ​​​​the maximum memory -XX:MaxNewSize:-Xss 15120, which makes JBoss consume 15M memory immediately every time an additional thread (thread) is added, and the optimal value should be 128K, and the default value seems to be 512k. +XX: AggressiveHeap will make Xms meaningless. This parameter makes jvm ignore the Xmx parameter, frantically eats up a G of physical memory, and then eats up a G of swap. -Xss: Stack size of each thread –verbose: gc real garbage collection information -Xloggc: gc.log specifies the garbage collection log file -Xmn: young generation heap size, generally set to Xmx 1/3,4 -XX :+UseParNewGC: Shorten minor collection time -XX:+UseConcMarkSweepGC: Shorten main collection time Tip: This option is more appropriate when the heap size is relatively large and the main collection time is long.

The full name of PermGen space is Permanent Generation space, which refers to the permanent storage area of ​​memory. OutOfMemoryError: PermGen space is memory outflow on the surface, and the solution must be to increase memory. Let’s talk about why there is memory loss: this part is used to store Class and Meta information. When Class is loaded, it is put into the PermGen space area. It is different from the heap area where instances are stored. GC (Garbage Collection) will not be in the The main program runs to clean up the PermGen space, so if you change the method: -Xms256m -Xmx256m -XX: MaxNewSize = 256m -XX: MaxPermSize = 256m -XX: MaxPermSize = 256m -XX: MaxPermSize = 256m 2, redeploy in tomcat An outofmemory error occurs. There are several reasons:
1. Proxool is used, because proxool contains an old version of cglib.
2, log4j, it is best not to use, only common-logging
3, the old version of cglib, update to the latest version quickly
. 4. Update to the latest hibernate3.2 3.
 

Guess you like

Origin blog.csdn.net/weixin_43997319/article/details/126938893