-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add minimal, multi stream support to minimal-download client #38
Conversation
Pull Request Test Coverage Report for Build 7496086894Warning: This coverage report may be inaccurate.We've detected an issue with your CI configuration that might affect the accuracy of this pull request's coverage report.
💛 - Coveralls |
This change consolidates websocket logic into the download() method so that connection start and shutdown can happen concurrently across multiple streams. As such, we checkpoint firstStart firstClose and lastStart and lastClose times as well as byte counts at significant events. With these variables, we can calculate various avg rates or a peak rates.
@robertodauria what do you think? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
. "Peak" results are just marginally (but consistently) better for me - e.g. increase of 0.1 Mb/s over 60 Mb/s
Reviewed 1 of 1 files at r2, all commit messages.
Reviewable status: complete! 1 of 1 approvals obtained (waiting on @stephen-soltesz)
cmd/minimal-download/main.go
line 314 at r2 (raw file):
case streamCount > 1 && stream == 0: // Only do this for one stream. s.mu.Lock()
Is locking needed here? s.firstStartTime
is only written once before this loop starts. Are there cases where this access can lead to a race?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
Reviewable status: complete! 1 of 1 approvals obtained (waiting on @robertodauria)
cmd/minimal-download/main.go
line 314 at r2 (raw file):
Previously, robertodauria (Roberto D'Auria) wrote…
Is locking needed here?
s.firstStartTime
is only written once before this loop starts. Are there cases where this access can lead to a race?
I think you're right. I think I was imagining the contention around lastStartTime
. But you're right we're guaranteed that someone (maybe this thread) has already written this value and it won't be written again.
Previously, the
minimal-download
client only operated on a single stream. To contrast this tool with other multi stream tools, this change adds a minimal support for multi stream downloads.The final download rate is currently calculated from the "first-open to first-close" time window.
For example:
This change is