Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Cursor memory issues
Cursor memory issues [message #1712222] Thu, 22 October 2015 08:45 Go to next message
Steven Huypens is currently offline Steven HuypensFriend
Messages: 3
Registered: October 2015
Junior Member
After thorough testing, I've come to the following conclusions. Can anybody confirm these issues ? Or, even better, has a solution or workaround.

- Using a ScrollableCursor to iterate over a large resultSet of entities uses a lot of memory. First of all the Oracle driver holds a reference to each visited row, which is a known feature/bug. But also EclipseLink consumes a lot of memory, for a list of deferredEvents (which can be seen in the heapDump) which only grows over time wile you iterate. Regularly clearing the cursor or the entityManager has no effect on this memory usage.

- Using a CursoredStream to iterate over a large resultSet of entities uses a lot of memory, when you have at least 1 @BatchFetch-annotated relation. From the heapDump I can see a lot of memory consumed by 1 BatchFetchPolicy-object.

For now, our workaround is to iterate with a CursoredStream over Tuples instead of complete (@Batch-Fetch) entities.
Re: Cursor memory issues [message #1713072 is a reply to message #1712222] Fri, 30 October 2015 15:26 Go to previous messageGo to next message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1389
Registered: July 2009
Senior Member
BatchFetch is probably not a strategy you want to be using with ScrollableCursor or CursoredStream, as it requires keeping track of everything read in so far so that the untriggered batch fetch attribute can be populated on all read in entities when it gets accessed. I would suggest overriding the batch fetch with either use joining, or relying on the default strategy of only loading the accessed relationship.

Pagination queries with a batch fetch using the IN strategy option might give you better performance depending on the object model and usage patterns.

As for ScrollableCursor causing deferredEvents to be held; this looks like it could be a bug. Try the latest and file it, as these should get triggered and cleared during the cursor's normal execution. A workaround would be to obtain the Session and call executeDeferredEvents() directly.

Best Regards,
Chris
Re: Cursor memory issues [message #1713178 is a reply to message #1713072] Mon, 02 November 2015 05:06 Go to previous message
Steven Huypens is currently offline Steven HuypensFriend
Messages: 3
Registered: October 2015
Junior Member
Hi Chris,

Thanks for your reply.

Our domain-objects our primarly used in a paged UI, therefor their relations are BatchFetch-annotated. Using pagination queries for our batch-jobs (instead of cursors) is too slow because of the count-query that is executed for each page.

I'm not sure what you mean by 'the latest' and 'file it', I'm using EclipseLink 2.6.1 for the moment...

Kind regards,
Steven
Previous Topic:Where is the Mapping Workbench in 2.6 ?
Next Topic:Generated count queries with CriteriaBuilder
Goto Forum:
  


Current Time: Thu Apr 25 14:27:32 GMT 2024

Powered by FUDForum. Page generated in 0.03478 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top