org.hibernate.engine.spi.EntityKey consumes a lot of memory

Description

We have just migrated our application to Springboot 3.x, Spring Data JPA 3.1.x & Hibernate 6.1.7 Final.

Immediately we observed heap memory spike as we deployed same code without any significant changes.

Context: We're trying to fetch a stream of objects from SQL db, and write straight onto a csv file in azure blob storage. As data volume is large 13+GB, we're setting few query hints to fetch 500 objects at a time, disable cacheing also read committed.

We're flushing/Clearing both OpenCSV writer and entity manager every 1500 records. This was working all good, until we did this migration.

Few code snippets & Profiler Analysis

Repository Class

Profiler Log:  I tried few things such as entityManagerFactory.getCache.evictAll() seems doesn't work.

We're looking to clear these EntityKey objects from Heap. We tried pagination but it's too slow to export such a large volume data.

Activity

Show:

Sanne Grinovero April 11, 2023 at 9:08 AM

Thansk for reporting back! I'll close it

Hrushikesh Mahapatro April 11, 2023 at 6:20 AM

This issue seems to be resolved in 6.2.0.Final

Fixed

Details

Assignee

Reporter

Labels

Worked in

Components

Fix versions

Affects versions

Priority

Created April 6, 2023 at 3:11 PM
Updated April 11, 2023 at 9:08 AM
Resolved April 11, 2023 at 9:08 AM