Improve lazy loading of loaders in AbstractEntityPersister

Description

The loaders in AbstractEntityPersister require a large amount of memory and are not always necessary. The solution for delaying the creation of certain loaders can be used on the other loaders too.

In our scenario wih about 1000 Mappings the SessionFactory needs only 66 MByte instead of 151 MByte.

Environment

Hibernate 5.3.4

Activity

Show:
Sanne Grinovero
October 21, 2020, 9:40 AM

Very interesting, I’d be happy to look into this.

Is there anything specific in your mappings that would help me reproduce this?

Barthel Steckemetz
October 28, 2020, 8:39 AM

The only thing specific are longer column names. I am attaching

1. testcase project

2. two screen shots of memory footprint of SingleTableEntityPersister. With and without patch.

The difference is about 20 kb or about 20 percent of the total memory of SingleTableEntityPersister. In our large projects with about 1000 Mappings this is significant.

Sanne Grinovero
October 28, 2020, 11:20 AM
Edited

Many thanks, that’s very helpful. I’ll see what we can do: I’m taking your patch as a starting point but while at it there’s some additional things I’d like to re-work, I hope you don’t mind.

Also worth noting: I just spent a week on other memory-saving patches; the other ones are unrelated with SingleTableEntityPersister, but I expect that when we’ll combine them all in the next release there should be many benefits in terms of memory overhead.

Sanne Grinovero
November 4, 2020, 3:49 PM

Hi , I hope you’ve seen we released this:

Thanks again for all your help!

Barthel Steckemetz
November 5, 2020, 9:39 AM

Great! Thanks very much for this.

Fixed

Assignee

Sanne Grinovero

Reporter

Barthel Steckemetz

Fix versions

None

Labels

backPortable

None

Suitable for new contributors

Yes, likely

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Minor
Configure