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

Avoid unnecessary reopening of HTTP streams in GetObject() #1908

Merged
merged 1 commit into from Dec 1, 2023

Conversation

PeterCxy
Copy link
Contributor

@PeterCxy PeterCxy commented Dec 1, 2023

Sometimes consumers of Seek() might use it for purposes other than chaging the current read/write offset. For example, using whence = io.SeekCurrent to get the current seek position. However, minio-go invalidates the underlying HTTP stream unconditionally when Seek() is called, resulting in massive performance degradation in these scenarios.

This commit avoids these issues by only reopening the stream if the seek position is actually changed.

t2bot/matrix-media-repo#516 is an example of such a performance issue resolved by this patch.

Sometimes consumers of Seek() might use it for purposes other than
chaging the current read/write offset. For example, using whence =
io.SeekCurrent to get the current seek position. However, minio-go
invalidates the underlying HTTP stream unconditionally when Seek() is
called, resulting in massive performance degradation in these scenarios.

This commit avoids these issues by only reopening the stream if the seek
position is actually changed.
Copy link
Contributor

@klauspost klauspost left a comment

Choose a reason for hiding this comment

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

LGTM

@harshavardhana harshavardhana merged commit 7c8e5d6 into minio:master Dec 1, 2023
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants