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 Worker Versioning doc #1533

Merged
merged 23 commits into from
Jun 16, 2023
Merged

Add Worker Versioning doc #1533

merged 23 commits into from
Jun 16, 2023

Conversation

Sushisource
Copy link
Member

@Sushisource Sushisource commented Sep 1, 2022

What does this PR do?

Adds conceptual documenatation on the new Worker Versioning feature

Notes to reviewers

  • Is there anything we can do to keep this hidden until it's released, or should we just not merge until then?
  • There are TODOs about other sections to add, probably makes sense to add them to this PR, but I'll leave that in your hands

Closes #1387

@Sushisource Sushisource requested a review from a team as a code owner September 1, 2022 20:55
Copy link
Member

@dnr dnr left a comment

Choose a reason for hiding this comment

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

Mostly just some tweaks to make it read smoother and less formal, and question about build id vs version

docs/concepts/what-is-worker-versioning.md Outdated Show resolved Hide resolved
docs/concepts/what-is-worker-versioning.md Outdated Show resolved Hide resolved
docs/concepts/what-is-worker-versioning.md Outdated Show resolved Hide resolved
docs/concepts/what-is-worker-versioning.md Outdated Show resolved Hide resolved
docs/concepts/what-is-worker-versioning.md Outdated Show resolved Hide resolved
docs/concepts/what-is-worker-versioning.md Outdated Show resolved Hide resolved

The primary use case that this feature makes much simpler is the deployment of incompatible changes to short-lived workflows. On Task Queues making use of this feature, the workflow starter does not need to know that there are new versions being introduced. New [Workflow Executions](/concepts/what-is-a-workflow-execution) will run using the new code in the newly deployed workers, and old (but still open) workflows will only be processed by workers with an appropriate version. Old workers may be decommissioned once there are no longer any open workflows using their version.

For example if you have a workflow which never takes longer than a day to execute, a great strategy is to simply always assign a new Build ID to every new build of your worker and add it to the graph as the new default version. Because you know your workflow never takes more than a day to complete, you know that you'll never have to leave older workers running for more than a day once you've deployed the new version (assuming availability).
Copy link
Member

Choose a reason for hiding this comment

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

question I have after reading this: how do I prune those old version from the graph once I decommission the workers?

Copy link
Member Author

Choose a reason for hiding this comment

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

You don't! They're expected to just sit around until they eventually page out, if ever. I'll add a bit on that.


Whether you use `tctl` or an SDK, updating the version graph feels the same.

You'll specify the task queue you're targeting, the Build ID you're adding (or moving), whether or not it is to become the new default version, and some existing version it should be considered compatible with, if any.
Copy link
Member

Choose a reason for hiding this comment

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

here and elsewhere, both "Build ID" and "version" are used and I can't really tell what the difference is. are they synonyms?

I sorta get that a Build ID is a property of a worker, and a version is a thing in the graph, but since there's a 1:1 mapping between them, do we want to use different terms?

Copy link
Member Author

Choose a reason for hiding this comment

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

They're effectively synonyms for the user. I think there is some value in using both terms here, distinguished like you said, since it helps contextualize when we're talking about something inside vs outside of the graph... but I'm open to suggestion.

Maybe I can just add a little bit about the two terms near the top?

to the front (along with its entire compatible branch), as long as you have targeted the most recent
version in that compatible branch.

You can't delete versions. This is to help avoid a situation where workflows accidentally become stuck with
Copy link
Member

Choose a reason for hiding this comment

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

maybe comment on max size and when things fall out here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Will do

@rachfop
Copy link
Contributor

rachfop commented Sep 14, 2022

[note to myself]
This awaits version 1.19 before merging.

@flossypurse flossypurse requested a review from djmagee September 21, 2022 19:02
@djmagee djmagee marked this pull request as draft September 22, 2022 01:36
@djmagee
Copy link
Contributor

djmagee commented Sep 22, 2022

I converted this PR to draft to ensure that it doesn't accidentally get merged too early, and I've started a terminology-and-style review.

docs/concepts/what-is-worker-versioning.md Outdated Show resolved Hide resolved
docs/concepts/what-is-worker-versioning.md Outdated Show resolved Hide resolved
docs/concepts/what-is-worker-versioning.md Outdated Show resolved Hide resolved
docs/concepts/what-is-worker-versioning.md Outdated Show resolved Hide resolved
docs/concepts/what-is-worker-versioning.md Outdated Show resolved Hide resolved
docs/concepts/what-is-worker-versioning.md Outdated Show resolved Hide resolved
docs/concepts/what-is-worker-versioning.md Outdated Show resolved Hide resolved
docs/concepts/what-is-worker-versioning.md Outdated Show resolved Hide resolved
docs/concepts/what-is-worker-versioning.md Outdated Show resolved Hide resolved
docs/concepts/what-is-worker-versioning.md Outdated Show resolved Hide resolved
@vercel
Copy link

vercel bot commented Sep 29, 2022

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

Name Status Preview Updated
temporal-documentation ✅ Ready (Inspect) Visit Preview Sep 29, 2022 at 6:50PM (UTC)

receive Tasks as usual. Workers who have opted in don't poll the Task Queue because they can't
receive Tasks for Workflows that have no associated version.

:::note Versions don't need to be semver!
Copy link
Member

Choose a reason for hiding this comment

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

nit: it's not semver if it's only 2 parts.

Copy link
Member

Choose a reason for hiding this comment

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

nit on your nit: 2-part version numbers can still be in the general class of semantic versions, even if they're not "semver".

Suggested change
:::note Versions don't need to be semver!
:::note Versions don't need to follow semver or any other semantic versioning standard!

- Add a version to an existing set that is compatible with an existing version.
- Optionally making it the default for that set
- Optionally making that set the overall-default set.
- Promote a version within an existing set to become the default for that set.
Copy link
Member

Choose a reason for hiding this comment

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

nit: this doesn't have an example above

configurable on Temporal Server via the `limit.versionBuildIDPerQueue` dynamic config property.
Operations to add new Build IDs to the sets will fail if the limit would be exceeded.

There is also a limit on the number of sets, which defaults to 10. This limit is configurable via
Copy link
Member

Choose a reason for hiding this comment

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

Not a docs concern but 10 might not be enough as the default assuming daily deployment and an arbitrary long running workflow.

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't care what it is but 10 is what David / Yimin thought was plausible for overhead. Whatever it ends up being we can just adjust this later.

assuming daily deployment and an arbitrary long running workflow

I mean, if it runs arbitrarily long, no limit is sufficient so it's a bit of a moot point.

docs-src/concepts/what-is-worker-versioning.md Outdated Show resolved Hide resolved
docs-src/concepts/what-is-worker-versioning.md Outdated Show resolved Hide resolved
You can use this technique with longer-lived Workflows as well. Just be aware that you might need to
keep multiple versions of Workers running while open Workflows complete.

You can also use the feature to prevent a buggy codepath from being taken on currently open
Copy link
Member

Choose a reason for hiding this comment

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

this is correct, but sort of a weird way to introduce the feature. the normal compatible changes I might want to make are things like adjusting timeouts, changing activities only, changing logs/metrics, etc. where you have a new build, but you wouldn't really say there's a buggy codepath, just that you have new code you want to use instead

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point, mentioned that first.

docs-src/concepts/what-is-worker-versioning.md Outdated Show resolved Hide resolved
docs-src/concepts/what-is-worker-versioning.md Outdated Show resolved Hide resolved

Continue-as-new from a Workflow on a versioned Task Queue will, by default, start the continued
Workflow on the same compatible set as the original Workflow. Continuing-as-new onto a different
task queue will not assign any particular version.
Copy link
Member

Choose a reason for hiding this comment

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

are we going to add the feature to c-a-n onto the latest (on the same queue)?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes... but I wanted to avoid having to specify exactly how a user does that b/c we haven't added it to the command yet and it'll probably look slightly different in each SDK. I could say something generic like "Look at your SDK's reference docs for c-a-n" or something

Copy link
Member

Choose a reason for hiding this comment

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

I think we're going to need this feature for child workflows as well.
This default behavior where everything stays in the same compatible version will make it hard to retire old workers in some scenarios.

Copy link
Member Author

Choose a reason for hiding this comment

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

Left it generic for now

docs-src/concepts/what-is-worker-versioning.md Outdated Show resolved Hide resolved
receive Tasks as usual. Workers who have opted in don't poll the Task Queue because they can't
receive Tasks for Workflows that have no associated version.

:::note Versions don't need to be semver!
Copy link
Member

Choose a reason for hiding this comment

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

nit on your nit: 2-part version numbers can still be in the general class of semantic versions, even if they're not "semver".

Suggested change
:::note Versions don't need to be semver!
:::note Versions don't need to follow semver or any other semantic versioning standard!

docs-src/concepts/what-is-worker-versioning.md Outdated Show resolved Hide resolved
@rachfop
Copy link
Contributor

rachfop commented Jun 13, 2023

Created a PR off this branch to include it in the docs:
#2109
Awaiting docs approval first.

* Make style changes to 1533

* Add feedback
@Sushisource Sushisource marked this pull request as ready for review June 16, 2023 18:15
Copy link
Contributor

@djmagee djmagee left a comment

Choose a reason for hiding this comment

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

I still have docs-src/go/how-to-use-worker-versioning-in-go.md to review, but here's this set of changes.

docs-src/concepts/what-is-worker-versioning.md Outdated Show resolved Hide resolved
docs-src/concepts/what-is-worker-versioning.md Outdated Show resolved Hide resolved
docs-src/concepts/what-is-worker-versioning.md Outdated Show resolved Hide resolved
docs-src/concepts/what-is-worker-versioning.md Outdated Show resolved Hide resolved
docs-src/concepts/what-is-worker-versioning.md Outdated Show resolved Hide resolved
docs-src/concepts/what-is-worker-versioning.md Outdated Show resolved Hide resolved
docs-src/concepts/what-is-worker-versioning.md Outdated Show resolved Hide resolved
docs-src/concepts/what-is-worker-versioning.md Outdated Show resolved Hide resolved
docs-src/concepts/what-is-worker-versioning.md Outdated Show resolved Hide resolved
docs-src/concepts/what-is-worker-versioning.md Outdated Show resolved Hide resolved
Copy link
Contributor

@djmagee djmagee left a comment

Choose a reason for hiding this comment

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

Final set of comments.

docs-src/go/how-to-use-worker-versioning-in-go.md Outdated Show resolved Hide resolved
docs-src/go/how-to-use-worker-versioning-in-go.md Outdated Show resolved Hide resolved
docs-src/go/how-to-use-worker-versioning-in-go.md Outdated Show resolved Hide resolved
docs-src/go/how-to-use-worker-versioning-in-go.md Outdated Show resolved Hide resolved
docs-src/go/how-to-use-worker-versioning-in-go.md Outdated Show resolved Hide resolved
docs-src/java/how-to-use-worker-versioning-in-java.md Outdated Show resolved Hide resolved
docs-src/java/how-to-use-worker-versioning-in-java.md Outdated Show resolved Hide resolved
docs-src/java/how-to-use-worker-versioning-in-java.md Outdated Show resolved Hide resolved
docs-src/java/how-to-use-worker-versioning-in-java.md Outdated Show resolved Hide resolved
docs-src/java/how-to-use-worker-versioning-in-java.md Outdated Show resolved Hide resolved
docs-src/concepts/what-is-worker-versioning.md Outdated Show resolved Hide resolved
docs-src/concepts/what-is-worker-versioning.md Outdated Show resolved Hide resolved
docs-src/concepts/what-is-worker-versioning.md Outdated Show resolved Hide resolved
Copy link
Contributor

@rachfop rachfop left a comment

Choose a reason for hiding this comment

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

lgtm

@Sushisource Sushisource merged commit 3b6b4e4 into main Jun 16, 2023
@Sushisource Sushisource deleted the worker-versioning branch June 16, 2023 22: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.

Go Concept page for worker versioning
5 participants