A permanent solution is available in vSphere 7.0 and later versions.
For vSphere 6.7 and earlier, apply the work-around mentioned below.
Workaround:
Before proceeding, take an offline snapshot of vCenter.
The work-around has two sections:
1. Limit the number of hprof dumps to 4 to prevent the /storage/log filling up
2. Enable String De-duplication to enable efficient use of heap memory by the analytics service and prevent it from running out of memory
- Create a file called cleanup.sh in etc/vmware-analytics/ and copy the following script inside the file:
#!/bin/sh
# Delete old hprof files
HPROF_FILES_TO_REMOVE=`ls /storage/log/vmware/analytics/*.hprof -1t | tail -n +5`
rm -f $HPROF_FILES_TO_REMOVE
# Delete old gclog files
GCLOG_FILES_TO_REMOVE=`ls /storage/log/vmware/analytics/*-gc*.log.*[^.current] -1t | tail -n +10`
rm -f $GCLOG_FILES_TO_REMOVE |
- Make the cleanup.sh file executable:
- Add the following line to the StartCommandArgs of the analytics service in
/etc/vmware/vmware-vmon/svcCfgfiles/analytics.json
"-XX:OnOutOfMemoryError='/etc/vmware-analytics/cleanup.sh'", |
- Set the following JVM arguments in the same StartCommandArgs section of the analytics service in
/etc/vmware/vmware-vmon/svcCfgfiles/analytics.jsonfile
to optimize heap memory usage in the analytics service:
"-XX:+UseG1GC",
"-XX:+UseStringDeduplication", |
- Restart the analytics service: