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

Add pullRegion to streams to make the ingest node sticky #2127

Merged
merged 7 commits into from
Apr 15, 2024

Conversation

leszko
Copy link
Contributor

@leszko leszko commented Apr 9, 2024

This is the updated flow:

  1. Fetch the region from Catalyst/Mist (effectively using MistUtilLoad to decide on region based on stream.pull.location)
  2. Store this region in the stream object as stream.pullRegion
  3. Use this region in catalyst-api (so if the it's being pulled by the wrong region, then it changes the region)

This way, we resolve region once in /pull and then re-use the same region for stream pulling. This should make some improvement in the ingest node, and what's even better, we can start logging that (lat,lon)=>region, and then have data to say if out method for choosing ingest node (MistUtilLoad) is correct.

One of the further idea would be to not use MistUtilLoad, but just always use the geographically closest node.

Related PRs:

Copy link

vercel bot commented Apr 9, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
livepeer-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 12, 2024 10:27am

@leszko leszko changed the title Add createdRegion to streams Add pullRegion to streams to make the ingest node sticky Apr 11, 2024
@leszko leszko marked this pull request as ready for review April 11, 2024 14:32
@leszko leszko requested a review from a team as a code owner April 11, 2024 14:32
@@ -712,6 +713,28 @@ describe("controllers/stream", () => {
const document = await db.stream.get(stream.id);
expect(db.stream.addDefaultFields(document)).toEqual(updatedStream);
});
it("should extract region from redirected playback url", async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

It might be good to have some flv urls in here to verify nothing breaks:
e.g /flv/<playback-id>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As pointed out below, we don't use it for /flv

return null;
}
const url = new URL(
pathJoin(ingest, `hls`, "not-used-playback", `index.m3u8`)
Copy link
Contributor

Choose a reason for hiding this comment

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

don't we need to handle flv as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, this call is not for the "any redirect", this is just to discover which should be the ingest node.

So, kind-of hack the system and use catalyst-api redirect balancing (effectively using MistUtilLoad) to divide on the ingest node.

@leszko leszko merged commit 0ed60af into master Apr 15, 2024
13 checks passed
@leszko leszko deleted the rafal/stream-pull-ingest-fix branch April 15, 2024 07:29
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.

2 participants