关闭Biased Locking(偏向锁) 1.6默认开启(针对单线程反复锁优化,多线程高争用场景可考虑关闭)
打开 DoEscapeAnalysis 逃逸分析
打开锁粗化 EliminateLocks
-XX:-UseBiasedLocking -server -XX:+DoEscapeAnalysis -XX:+EliminateLocks -Xms4096m -Xmx8192m -server
http://chentmin.com/2013/06/12/biased-locking-and-lock-coarsening/
https://mechanical-sympathy.blogspot.co.uk/
给出的一些例子
Tuning Example 1: Tuning for Throughput
java -Xmx3800m -Xms3800m -Xmn2g -Xss128k -XX:+UseParallelGC -XX:ParallelGCThreads=20
Tuning Example 2: Try the parallel old generation collector
java -Xmx3550m -Xms3550m -Xmn2g -Xss128k -XX:+UseParallelGC -XX:ParallelGCThreads=20 -XX:+UseParallelOldGC
Tuning Example 3: Try 256 MB pages
java -Xmx2506m -Xms2506m -Xmn1536m -Xss128k -XX:+UseParallelGC -XX:ParallelGCThreads=20 -XX:+UseParallelOldGC -XX:LargePageSizeInBytes=256m
Tuning Example 4: Try -XX:+AggressiveOpts
java -Xmx3550m -Xms3550m -Xmn2g -Xss128k -XX:+UseParallelGC -XX:ParallelGCThreads=20 -XX:+UseParallelOldGC -XX:+AggressiveOpts -XX:+UseBiasedLocking
Tuning Example 6: Tuning for low pause times and high throughput
java -Xmx3550m -Xms3550m -Xmn2g -Xss128k -XX:ParallelGCThreads=20 -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:SurvivorRatio=8 -XX:TargetSurvivorRatio=90 -XX:MaxTenuringThreshold=31
Tuning Example 7: Try AggressiveOpts for low pause times and high throughput
java -Xmx3550m -Xms3550m -Xmn2g -Xss128k -XX:ParallelGCThreads=20 -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:SurvivorRatio=8 -XX:TargetSurvivorRatio=90 -XX:MaxTenuringThreshold=31 -XX:+AggressiveOpts
Java SE 6 Performance White Paper
© 2017, 新之助meow. 原创文章转载请注明: 转载自http://www.xinmeow.com