我们有一个以集群模式(6 个节点)运行 Wildfly 应用服务器的应用程序。
当触发 GC 时,我们有时会看到 JVM 冻结 16 秒。
应用程序对时间敏感,如果 15 秒内没有收到心跳响应,集群中的其他节点会认为该节点已死亡(其中 JVM 暂停)。
因此,JVM 冻结会导致应用程序不稳定。
为了了解 GC 期间发生的情况,我们启用了热点、安全点日志,并在 GC 暂停时查看以下跟踪。
谁能解释一下以下参数的含义。
1.) active_workers(): 13
2.) new_acitve_workers: 13
3.) prev_active_workers: 13
4.) active_workers_by_JT: 3556
5.) active_workers_by_heap_size: 146
环境详情:Linux 64 位 RHEL 7
OpenJDK 1.8
堆大小:12GB(Young:4GB,Tenure:8GB)
CPU核心:16个
VMware ESX 5.1
JVM 参数:
-XX:ThreadStackSize=512
-Xmx12288m
-XX:+UseParallelGC
-XX:+UseParallelOldGC
-XX:MaxPermSize=1024m
-XX:+DisableExplicitGC
-XX:NewSize=4096m
-XX:MaxNewSize=4096m
-XX:ReservedCodeCacheSize=256m
-XX:+UseCodeCacheFlushing
-XX:+UseDynamicNumberOfGCThreads
对于调整这些 JVM 参数以减少 GC 暂停时间有什么建议吗?
GC logs:
GCTaskManager::calc_default_active_workers() : active_workers(): 13 new_acitve_workers: 13 prev_active_workers: 13
active_workers_by_JT: 3556 active_workers_by_heap_size: 146
GCTaskManager::set_active_gang(): all_workers_active() 1 workers 13 active 13 ParallelGCThreads 13
JT: 1778 workers 13 active 13 idle 0 more 0
2016-10-06T07:38:47.281+0530: 48313.522: [Full GC (Ergonomics) DrainStacksCompactionTask::do_it which = 3 which_stack_index = 3/empty(0) use all workers 1
DrainStacksCompactionTask::do_it which = 7 which_stack_index = 7/empty(0) use all workers 1
DrainStacksCompactionTask::do_it which = 2 which_stack_index = 2/empty(0) use all workers 1
DrainStacksCompactionTask::do_it which = 0 which_stack_index = 0/empty(0) use all workers 1
DrainStacksCompactionTask::do_it which = 11 which_stack_index = 11/empty(0) use all workers 1
DrainStacksCompactionTask::do_it which = 6 which_stack_index = 6/empty(0) use all workers 1
DrainStacksCompactionTask::do_it which = 1 which_stack_index = 1/empty(0) use all workers 1
DrainStacksCompactionTask::do_it which = 12 which_stack_index = 12/empty(0) use all workers 1
DrainStacksCompactionTask::do_it which = 4 which_stack_index = 4/empty(0) use all workers 1
DrainStacksCompactionTask::do_it which = 5 which_stack_index = 5/empty(0) use all workers 1
DrainStacksCompactionTask::do_it which = 9 which_stack_index = 9/empty(0) use all workers 1
DrainStacksCompactionTask::do_it which = 8 which_stack_index = 8/empty(0) use all workers 1
DrainStacksCompactionTask::do_it which = 10 which_stack_index = 10/empty(0) use all workers 1
StealRegionCompactionTask::do_it region_stack_index 3 region_stack = 0x780be610 empty (1) use all workers 1
StealRegionCompactionTask::do_it region_stack_index 5 region_stack = 0x780be730 empty (1) use all workers 1
StealRegionCompactionTask::do_it region_stack_index 7 region_stack = 0x780be850 empty (1) use all workers 1
StealRegionCompactionTask::do_it region_stack_index 11 region_stack = 0x780bea90 empty (1) use all workers 1
StealRegionCompactionTask::do_it region_stack_index 1 region_stack = 0x780be4f0 empty (1) use all workers 1
StealRegionCompactionTask::do_it region_stack_index 10 region_stack = 0x780bea00 empty (1) use all workers 1
StealRegionCompactionTask::do_it region_stack_index 8 region_stack = 0x780be8e0 empty (1) use all workers 1
StealRegionCompactionTask::do_it region_stack_index 4 region_stack = 0x780be6a0 empty (1) use all workers 1
StealRegionCompactionTask::do_it region_stack_index 0 region_stack = 0x780be460 empty (1) use all workers 1
StealRegionCompactionTask::do_it region_stack_index 2 region_stack = 0x780be580 empty (1) use all workers 1
StealRegionCompactionTask::do_it region_stack_index 6 region_stack = 0x780be7c0 empty (1) use all workers 1
StealRegionCompactionTask::do_it region_stack_index 12 region_stack = 0x780beb20 empty (1) use all workers 1
StealRegionCompactionTask::do_it region_stack_index 9 region_stack = 0x780be970 empty (1) use all workers 1
[PSYoungGen: 63998K->0K(4082176K)] [ParOldGen: 8346270K->3657870K(8388608K)] 8410268K->3657870K(12470784K), [Metaspace: 465864K->465775K(1495040K)], 16.0898939 secs]
[Times: user=180.57 sys=2.46, real=16.09 secs]
2016-10-06T07:39:03.373+0530: 48329.615: Total time for which application threads were stopped: 16.2510644 seconds, Stopping threads took: 0.0036805 seconds
安全点日志:
48313.363: ParallelGCFailedAllocation [ 2384 0 2 ] [ 0 0 3 35 16210 ] 0
在此先感谢您的帮助。