[hibernate-issues] [JIRA] (HHH-14094) Optimize after transaction completion cache processes memory

Alex CD (JIRA) jira at hibernate.atlassian.net
Wed Jul 1 16:03:02 EDT 2020


Alex CD ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%3A9b0f6d49-bc76-4aca-875b-c8525b2f039d ) *created* an issue

Hibernate ORM ( https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiZTkxNWE1YTMwNTY1NDI1OWFjOTlkNmUzNzYxMmU0MzciLCJwIjoiaiJ9 ) / Improvement ( https://hibernate.atlassian.net/browse/HHH-14094?atlOrigin=eyJpIjoiZTkxNWE1YTMwNTY1NDI1OWFjOTlkNmUzNzYxMmU0MzciLCJwIjoiaiJ9 ) HHH-14094 ( https://hibernate.atlassian.net/browse/HHH-14094?atlOrigin=eyJpIjoiZTkxNWE1YTMwNTY1NDI1OWFjOTlkNmUzNzYxMmU0MzciLCJwIjoiaiJ9 ) Optimize after transaction completion cache processes memory ( https://hibernate.atlassian.net/browse/HHH-14094?atlOrigin=eyJpIjoiZTkxNWE1YTMwNTY1NDI1OWFjOTlkNmUzNzYxMmU0MzciLCJwIjoiaiJ9 )

Issue Type: Improvement Affects Versions: 5.4.17 Assignee: Unassigned Created: 01/Jul/2020 13:03 PM Priority: Major Reporter: Alex CD ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%3A9b0f6d49-bc76-4aca-875b-c8525b2f039d )

If caching is enabled, many actions are stored to execute cache related actions at transaction complete.
These stored processes also keep reference to entity instances without needing them, thus leading to a large memory footprint for long running transactions.
Even calling EntityManager.clear() has no effect on memory, because the instances are retained by these cache operations!

The following method is used to check if an action needs to be registered for later processing.

	protected boolean needsAfterTransactionCompletion() {
		return persister.canWriteToCache() || hasPostCommitEventListeners();
	}

When cache is enabled, it returns true.

In case no post commit event listener is registered, the entity instance is not used in *doAfterTransactionCompletion* methods of *EntityAction* subclasses (EntityInsertAction, EntityDeleteAction, EntityUpdateAction).

A separation of logic would allow to keep only the *dehydrated* state for the cache operation and clearing entity instance memory.

( https://hibernate.atlassian.net/browse/HHH-14094#add-comment?atlOrigin=eyJpIjoiZTkxNWE1YTMwNTY1NDI1OWFjOTlkNmUzNzYxMmU0MzciLCJwIjoiaiJ9 ) Add Comment ( https://hibernate.atlassian.net/browse/HHH-14094#add-comment?atlOrigin=eyJpIjoiZTkxNWE1YTMwNTY1NDI1OWFjOTlkNmUzNzYxMmU0MzciLCJwIjoiaiJ9 )

Get Jira notifications on your phone! Download the Jira Cloud app for Android ( https://play.google.com/store/apps/details?id=com.atlassian.android.jira.core&referrer=utm_source%3DNotificationLink%26utm_medium%3DEmail ) or iOS ( https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=EmailNotificationLink&mt=8 ) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100131- sha1:a811519 )
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/hibernate-issues/attachments/20200701/3beaceca/attachment.html 


More information about the hibernate-issues mailing list