使用-Xmx32m的GC日志如下:
808: [GC (Allocation Failure) [PSYoungGen: 9760K->32K(10240K)], 0.0003076 secs]
819: [GC (Allocation Failure) [PSYoungGen: 9760K->32K(10240K)], 0.0003079 secs]
830: [GC (Allocation Failure) [PSYoungGen: 9760K->32K(10240K)], 0.0002968 secs
2nd Allocation rate is (9760-32)/(819-808)= 884.36K
3rd Allocation rate is (9760-32)/(830-819)= 884.36K
使用-Xmx64m的GC日志如下:
808: [GC (Allocation Failure) [PSYoungGen: 20512K->32K(20992K)], 0.0003748 secs]
831: [GC (Allocation Failure) [PSYoungGen: 20512K->32K(20992K)], 0.0004538 secs]
855: [GC (Allocation Failure) [PSYoungGen: 20512K->32K(20992K)], 0.0003355 secs]
2nd allocation rate is (20512-32)/(831-808)=890.43K
3nd allocation rate is (20512-32)/(855-831)=853.33K
根据https://plumbr.io/handbook/gc-tuning-in-practice和http://stuff-gil-says.blogspot.com/2014/10/what-sort-of-allocation-rates-can.html帖子,较低的分配率更好。怎么样?
我不确定究竟是什么问题。链接涵盖了主题。我将总结一下: