Issue
- The high CPU usage is observed every hour in the database server and a large amount of data exists in SamlSpMessages and SamlSpAuthRequests table.
Environment
- DXP 7.1
Resolution
-
The root cause could be that the following two listeners somehow were not working for a while and a huge amount of expired records are not cleaned up. When the listeners are reactivated again, they require extensive resources to clean up these tables.
com.liferay.saml.runtime.internal.messaging.SamlSpMessageMessageListener
It's deleting expiredSamlSpAuthRequets by comparing the
createDatein DB and theSpAuthRequestMaxAgeconfiguration in Liferay.
com.liferay.saml.runtime.internal.messaging.SamlSpAuthRequestMessageListener
It's deleting ExpiredSamlSpMessages by checking the Expiration date.
-
To clean up the expired records in SamlSpMessages and SamlSpAuthRequests table, consider using the following API. It is recommended to do the clean up during non-peak hours.
com.liferay.saml.persistence.service.SamlSpMessageLocalServiceUtil.deleteExpiredSamlSpMessages();
com.liferay.saml.persistence.service.SamlSpAuthRequestLocalServiceUtil.deleteExpiredSamlSpAuthRequests();