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

Table Segment Reader may consume more memory than needed #5771

Closed
andreipaduroiu opened this issue Feb 20, 2021 · 0 comments · Fixed by #5783
Closed

Table Segment Reader may consume more memory than needed #5771

andreipaduroiu opened this issue Feb 20, 2021 · 0 comments · Fixed by #5783
Assignees

Comments

@andreipaduroiu
Copy link
Member

Describe the bug
TableBucket reader requests reads up to 1MB from the Read Index because it does not know the length of the entry to be read. if the underlying index is not too fragmented (i.e., it has a 1MB cache entry), then that whole entry will be returned, copied and a slice from it will be returned to upstream code. However that slice still points to a 1MB buffer, even if it only needs 100 bytes out of it.

Concurrent reads from a Table Segment can easily overwhelm the heap memory if they run in this situation.

Expected behavior
Make a copy of the slice if necessary - this should cause only the necessary data to be held in memory.
Additionally, perhaps read only the header first and then figure out how much more to read. This may help solve the extra memory being read, but it will come with performance implications (multiple read requests). TBD: explore a good balance here.

Additional context
TableBucketReader and underlying classes.

@andreipaduroiu andreipaduroiu self-assigned this Feb 20, 2021
sachin-j-joshi pushed a commit that referenced this issue Mar 19, 2021
Cherry-picking these PRs:

#5841: Issue #5840: (SegmentStore) Fixed a deadlock in SegmentKeyCache.
#5851: Issue #5850: (SegmentStore) Fixed a bug in WriterTableProcessor where it would attempt to flush to a deleted segment.
#5586: Issue #5581: (SegmentStore) Disabling non-essential cache inserts if cache utilization is high
#5804: Issue #5789: (SegmentStore) Improving stability during Segment Container Recoveries
#5811: Issue #5810: (SegmentStore) Fixed a StorageWriter bug that could lead to data loss
#5783: Issue #5771: (SegmentStore) Reducing the amount of heap memory used when doing Table Segment Reads.

Signed-off-by: Andrei Paduroiu <andrei.paduroiu@emc.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant