Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scroll memory improvement #1740

Merged
merged 3 commits into from
Jan 13, 2020
Merged

Conversation

rattuscz
Copy link
Contributor

@rattuscz rattuscz commented Jan 7, 2020

Remove reference to current result set before running another call to ES - without this it was effectively doubling memory requirement for data as json parsing and processing to ResultSet was done before previous ResultSet was released.

As i'm working with quite large dataset i hit memory limit and found i can fix it by just removing the reference before next search() call.

@rattuscz rattuscz changed the title Feature/scroll memory Scroll memory improvement Jan 7, 2020
CHANGELOG.md Outdated Show resolved Hide resolved
@ruflin
Copy link
Owner

ruflin commented Jan 9, 2020

Could you see any side effects of this change?

@rattuscz
Copy link
Contributor Author

rattuscz commented Jan 9, 2020

I've not seen any side effects, the _currentResultSet field is nulled just before next search is called, and so it is again set to next result inside the _setScrollId() method.
It should therefore be contained within the call of next() or rewind() and will be valid after the method returns.
I guess there is change in that last resultset is not available if search throws exception.

Also it may be good to include nulling the result in the clear() method, if for some reason not all results are iterated and it is therefore not removed during last next() call.
It's not my usecase though so i did not actually test it.

@thePanz
Copy link
Collaborator

thePanz commented Jan 13, 2020

@ruflin LGTM, should I squash-and-merge this one?

@ruflin
Copy link
Owner

ruflin commented Jan 13, 2020

@thePanz Go for it.

@rattuscz Perhaps we can follow up with the clear() part?

@thePanz
Copy link
Collaborator

thePanz commented Jan 13, 2020

Handling the "nulling" of the property in the clear() call would be great @rattuscz .
Could you open another PR for that? thank you!

@thePanz thePanz merged commit 9392fb0 into ruflin:master Jan 13, 2020
@rattuscz rattuscz deleted the feature/scroll-memory branch January 13, 2020 15:07
@rattuscz
Copy link
Contributor Author

@ruflin thought about the clear() and I believe it's mostly useless to manually set to null.

  • Either you use the scroll object again for iteration in which case it will be nulled before pulling new data
  • or you just discard the whole Scroll object therefore also removing the last ResultSet

So I'm not seeing any usecase for that after all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants