PowerFlex Manager 3.8: 内存不足 Java 堆错误导致性能不佳
Summary: Java 堆内存耗尽会导致 PFxM UI 性能不佳,以及针对各种任务(如资源清点、部署新服务或添加现有服务)的随机意外故障。
Symptoms
PFxM UI 表现出较差的性能,登录速度可能较慢,拉取 UI 中不同部分的速度也很慢。资源清点、部署新服务或添加现有服务等各种任务可能会意外失败。
而 asmui 和 asmManager 日志显示 Out-OfMemory 错误:
2024-06-01 01:17:24 [http-nio-9030-exec-4] (DeviceController.java:626) [ERROR] getDeviceList() - Exception from service call
java.lang.OutOfMemoryError: Java heap space
2024-06-01 01:17:24 [http-nio-9030-exec-4] (BaseController.java:304) [ERROR] Found generic exception in Controller
java.lang.OutOfMemoryError: Java heap space
2024-06-01 01:17:24 [http-nio-9030-exec-9] (DeviceController.java:626) [ERROR] getDeviceList() - Exception from service call
java.lang.OutOfMemoryError: Java heap space
2024-06-01 01:17:24 [http-nio-9030-exec-9] (BaseController.java:304) [ERROR] Found generic exception in Controller
java.lang.OutOfMemoryError: Java heap space
2024-06-01 01:17:26 [http-nio-9030-exec-6] (DeviceController.java:626) [ERROR] getDeviceList() - Exception from service call
java.lang.OutOfMemoryError: Java heap space
2024-06-01 01:17:26 [http-nio-9030-exec-6] (BaseController.java:304) [ERROR] Found generic exception in Controller
java.lang.OutOfMemoryError: Java heap space
...
2024-07-10 00:40:50 [http-nio-9030-exec-11] (RestTemplateResponseErrorHandler.java:47) [ERROR] REST Error: {
"detailMessage" : "Handler dispatch failed; nested exception is java.lang.OutOfMemoryError: Java heap space",
"cause" : {
"cause" : {
"cause" : null,
"stackTrace" : [ ],
"message" : "Java heap space",
"localizedMessage" : "Java heap space",
"suppressed" : [ ]
...
"stackTrace" : [ ],
"suppressedExceptions" : [ ],
"status" : 500,
"timestamp" : "2024-07-10T04:40:50.986+00:00",
"error" : "Internal Server Error",
"path" : "/AsmManager/job/",
"messages" : [ {
"messageBundle" : null,
"messageCode" : null,
"severity" : null,
"category" : null,
"displayMessage" : "Runtime error",
"responseAction" : null,
"detailedMessage" : "Handler dispatch failed; nested exception is java.lang.OutOfMemoryError: Java heap space",
"agentId" : null,
"correlationId" : null,
"timeStamp" : "2024-07-10T04:40:50.987+00:00",
"sequenceNumber" : 0
} ]
}
2024-07-10 00:40:50 [http-nio-9030-exec-11] (JobsController.java:83) [ERROR] getJobs() - Exception from service call
com.dell.asm.rest.common.exception.LocalizedWebApplicationException: HTTP 500 Internal Server Error
at com.dell.pfxm.springboot.helpers.error.RestTemplateResponseErrorHandler.handleError(RestTemplateResponseErrorHandler.java:64) ~[RestCommon-0.7.0-SNAPSHOT.jar!/:?]
...
影响
Java 堆内存耗尽会导致 PFxM UI 性能不佳,以及针对各种任务的随机意外故障。
Cause
asmui 和 asmManager 组件的默认 Java 堆内存范围分别为 128M-512M 和 512M-6144M。在较大的环境中,此内存范围可能不足以允许各种进程正确运行,从而导致堆内存耗尽。
PFxM 中具有大量对象的环境(例如,100+ 资源、3+ 个服务,32+ 个节点、10+ 个服务总数)将受益于更大的 Java 堆内存池。
Resolution
可以增加 asumui 和 asmManager 组件的 Java 堆大小。在过去,这通常被视为“大规模修补程序”,因为修补程序必须应用于当前 PFxM 实例,并且不会在 PFxM 升级期间保留。
不再需要修补程序,因为此更新应用于在整个 PFxM 升级过程中持续的配置文件。
提醒:在更新堆值之前,PFxM 虚拟机必须至少配置 20 个 vCPU(10 核/2 个插槽)和 56 GB 内存。
此过程需要重新启动 PFxM 虚拟机,请相应地制定计划。
1.从 PFxM CLI 中,备份当前的 asmui 和 asmManager Java 配置文件:
sudo cp /opt/Dell/ASM/conf/asmui-jvm-props.conf asmui-jvm-props.conf.bak sudo cp /opt/Dell/ASM/conf/asmManager-jvm-props.conf asmManager-jvm-props.conf.bak
2.在 Center 中创建 PFxM VM 的快照。
3.将 asmui 堆上限范围增加到 2048M:
echo '-Xloggc:/opt/Dell/ASM/logs/gc_asmui.log -XX:+PrintHeapAtGC -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=10M -XX:-HeapDumpOnOutOfMemoryError -XX:HeapDumpPath="/opt/Dell/ASM/logs/" -Xms128m -Xmx2048m -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -Dhttp.nonProxyHosts="localhost.localdomain|localhost|127.0.0.1" -Djava.io.tmpdir=/opt/Dell/ASM/temp -Dspring.profiles.active=main' > /opt/Dell/ASM/conf/asmui-jvm-props.conf
4.将 asmManager 堆上限范围增加到 18432M:
echo '-Xloggc:/opt/Dell/ASM/logs/gc_asmManager.log -XX:+PrintHeapAtGC -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=10M -XX:-HeapDumpOnOutOfMemoryError -XX:HeapDumpPath="/opt/Dell/ASM/logs/" -Xms512m -Xmx18432m -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -Dhttp.nonProxyHosts="localhost.localdomain|localhost|127.0.0.1" -Djava.io.tmpdir=/opt/Dell/ASM/temp -Dspring.profiles.active=main' > /opt/Dell/ASM/conf/asmManager-jvm-props.conf
5.重新启动 PFxM 虚拟机。
6.验证是否应用了配置更改:
cat /opt/Dell/ASM/conf/asmui-jvm-props.conf | grep -E 'Xms|Xmx' cat /opt/Dell/ASM/conf/asmManager-jvm-props.conf | grep -E 'Xms|Xmx'
7.实施更改并解决问题后,在 Center 中删除 PFxM 虚拟机快照。
影响
版本 3.8.6 及更高版本