Out of Memory (OOM) issues are perhaps one of the most common and generically occuring issues encountered whilst operating in a complex business process Portal environment.
OOM & WCM:
In the Enterprise Portal (EP) environment you encounter performance degradation on various server nodes, subsequently the Portal itself becomes inaccessible. You notice an unexpected restart of the Java engine along with checking the directory /usr/sap/<SID>/<InstID>/j2ee/cluster/serverX you notice an OOM.Hprof file has been automatically generated.
Upon analyzing the OOM.Hprof you find several core refereneces. The results show an Out of Memory error exception referencing Web Content Management (WCM) & the KM Cache "com.sapportals.wcm.util.cache.CacheFactory" which is pulling a significant grouping of the heap allocation.
KM: Out of Memory & Performance Pointers
The primary cause of performance impacts within the KMC is the activation of the AccessStatistic service on the KM repositories.
You can check if this service is indeed activated in the configuration of the KM repository managers
If you make a change in the repository managers i.e. a setting is updated with the removal of the AccessStatistic then a service restart will be required for the change to take effect.
Reproducing the Issue:
Log into the Enterprise Portal.
In the portal, upon performing navigation you begin to notice reduced perfomance accompanied with loss of navigation.
Severe performance degradation is followed subsequently by the Java Engine failing with a 666 exit code.
The 666 exit code highlights an OutOfMemory (OOM) error.
In the SAP directory search for the OOM.Hprof file via the path /usr/sap/ <SID>/ <InstID>/j2ee/cluster/serverX
Analysis of the OOM file points to the KM Cache "com.sapportals.wcm.util.cache.CacheFactory" as the source of the error.
The OOM issue due to KM caching and the and the solution is to apply the latest KMC-CM patch available.
Lastly from the KM side and in terms of a performance setup and the "slow response times". I've outlined some reference documentation below for your convenience:
How to Tune the Performance of Knowledge Management (NW7.0):