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

Send a Segment Upload Multiplier of 3 to local broadcaster #172

Merged
merged 1 commit into from
Nov 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion clients/broadcaster.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ type createStreamPayload struct {
}

type LivepeerTranscodeConfiguration struct {
Profiles []EncodedProfile `json:"profiles"`
Profiles []EncodedProfile `json:"profiles"`
SegUploadTimeoutMultiplier int `json:"segUploadTimeoutMultiplier"`
}

type Credentials struct {
Expand Down
4 changes: 3 additions & 1 deletion clients/broadcaster_local.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ func NewLocalBroadcasterClient(broadcasterURL string) (LocalBroadcasterClient, e
}

func (c LocalBroadcasterClient) TranscodeSegment(segment io.Reader, sequenceNumber int64, profiles []EncodedProfile, durationMillis int64, manifestID string) (TranscodeResult, error) {
conf := LivepeerTranscodeConfiguration{}
conf := LivepeerTranscodeConfiguration{
SegUploadTimeoutMultiplier: 3,
Copy link
Member

Choose a reason for hiding this comment

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

Just noting that this means that the timeout for upload from B -> O will always be 3x the seg duration and the overall HTTP timeout between B and O for a single segment (including upload + transcode response) is max(4 x seg duration, 8 seconds).

So, given seg duration = N, we have the upload timeout = 3N and the HTTP timeout = 4N.

In the worst case, where the upload takes 3N, that leaves N for the transcode response (i.e. O completes transcode and returns the URLs for the renditions to B) before we hit the HTTP timeout.

I'm not sure if that is the right ratio between timeouts, but this is probably fine for now as we can tweak as is needed

References:

https://github.com/livepeer/go-livepeer/blob/master/server/segment_rpc.go#L473
https://github.com/livepeer/go-livepeer/blob/2f306f6afdb21535612bb82867c5417c4643fe94/common/util.go#L38

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, good point @yondonfu - my thinking was that if this somewhat improves things or at least leads to them timing out later in the request then we can look at multiplying the overall timeout as well

}
conf.Profiles = append(conf.Profiles, profiles...)
transcodeConfig, err := json.Marshal(&conf)
if err != nil {
Expand Down