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

Reclaim PagesSerde memory in Query #15270

Merged
merged 1 commit into from
Dec 1, 2022
Merged

Conversation

losipiuk
Copy link
Member

@losipiuk losipiuk commented Dec 1, 2022

When we finish reading data for a query we can
safely null reference to PagesSerde used for deserializing query results. This allow GCing buffer references stored in PagesSerde.

Release notes

(x) This is not user-visible or docs only and no release notes are required.
( ) Release notes are required, please propose a release note for me.
( ) Release notes are required, with the following suggested text:

@@ -575,6 +577,7 @@ private synchronized QueryResultRows removePagesFromExchange(QueryInfo queryInfo
}
if (exchangeDataSource.isFinished()) {
exchangeDataSource.close();
serde = null; // null to reclaim memory
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it worth adding code comment why serde is more to null out important than eg exchangeDataSource?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think ideally it would be great to account for PageSerde memory in operators. A single PageSerde can retain up to 128KB of memory (when both encryption and compression are enabled). Hard to say how many open Exchange/TaskOutput operators can be open at the same time, but in theory it can accumulate.

Created an issue: #15273

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made comment more descriptive

@arhimondr
Copy link
Contributor

Great catch. Let's get this in before the release

When we finish reading data for a query we can
safely null reference to PagesSerde used for deserializing
query results. This allow GCing buffer references stored
in PagesSerde.
@losipiuk losipiuk merged commit 6d5eec5 into trinodb:master Dec 1, 2022
@github-actions github-actions bot added this to the 404 milestone Dec 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants