jvm启动参数NewRatio不生效 Posted on 2020-06-28 | Edited on 2022-09-21 | In 经验积累 , 项目积累 现象:jvm启动参数的配置,由于-Xmn的值优先级更高,所以NewRatio会被-Xmn覆盖。见下面的测试: 123456789# 这里NewSize是20MBjava -Xmn20M -XX:NewRatio=2 -Xms50M -XX:+PrintFlagsFinal -version | grep -E '(Old|New)Size' uintx MaxNewSize := 20971520 {product} uintx NewSize := 20971520 {product} uintx NewSizeThreadIncrease = 5320 {pd product} uintx OldSize := 31457280 {product}openjdk version "1.8.0_222"OpenJDK Runtime Environment (build 1.8.0_222-b10)OpenJDK 64-Bit Server VM (build 25.222-b10, mixed mode) {product} 123456789#这里是50MB的1/3,可见NewRatio生效了java -XX:NewRatio=2 -Xms50M -XX:+PrintFlagsFinal -version | grep -E '(Old|New)Size' uintx MaxNewSize := 1073741824 {product} uintx NewSize := 17301504 {product} uintx NewSizeThreadIncrease = 5320 {pd product} uintx OldSize := 35127296 {product}openjdk version "1.8.0_222"OpenJDK Runtime Environment (build 1.8.0_222-b10)OpenJDK 64-Bit Server VM (build 25.222-b10, mixed mode)