Skip to content

[Durable Objects] Add documentation for gradual deployments for Durable Objects.#13564

Merged
jp4a50 merged 7 commits intoproductionfrom
jphillips/do-gradual-deployments
Apr 3, 2024
Merged

[Durable Objects] Add documentation for gradual deployments for Durable Objects.#13564
jp4a50 merged 7 commits intoproductionfrom
jphillips/do-gradual-deployments

Conversation

@jp4a50
Copy link
Copy Markdown
Contributor

@jp4a50 jp4a50 commented Mar 21, 2024

No description provided.

- For a given deployment, requests to each Durable Object will always use the same Worker version.
- When you specify each version in the same order as the previous deployment and increase the percentage of a version, Durable Objects which were previously assigned that version will not be assigned a different version. In our example, Durable Object "foo" would never revert from version "B" to version "A".
- The Durable Object will only be [reset](/durable-objects/reference/troubleshooting/#durable-object-reset-because-its-code-was-updated) when it is assigned a different version, so each Durable Object will only be reset once in our example.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should we add a bullet for Websockets not being disconnected with gradual rollouts? I believe we can't remove https://github.com/cloudflare/cloudflare-docs/blob/production/content/durable-objects/reference/websockets.md?plain=1#L23 just yet

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Websockets will still be disconnected whenever a specific Durable Object's code is updated. The difference is that a gradual deployment may only update the code for a subset of DOs now, so only websockets to those DOs will be disconnected.

I think ideally we should have a dedicated section on Durable Object resets which defines when they happen and their side effects (e.g. websockets being disconnected) and both the above documentation and the documentation in your link should reference that.

What d'you think?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Makes sense, I'll track the DO reset behavior docs.

```
You should see 10 responses. Responses will reflect the content returned by the versions in your deployment. Responses will vary depending on the percentages configured in step #6.

## Gradual deployments for Durable Objects
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I would love see a section that directly addresses forwards and backwards compatibility requirements between eyeball Worker and Durable Objects during a release (old eyeball talks to new DO and new eyeball talks to old DO).

If this is already mentioned elsewhere outside of gradual deployments page (if not, I think it should be), this could be as simple as a link and mentioning that this easily missed compatibility issue will be exacerbated with gradual deployments.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good call. The requirement for forwards and backwards compatibility for durable objects and the worker that talks to them is briefly mentioned here so I will link to that for now and elaborate on how gradual deployments affects this problem.

I think we could generally do with a section explaining compatibility requirements more generally. I started drafting a new section in the "Versions & Deployments" page that was added in @tanushree-sharma 's PR but it's tricky to explain this in general terms without introducing new terminology and/or using diagrams/example code so I'll leave that for another time.

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages bot commented Mar 28, 2024

Deploying cloudflare-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: be02af1
Status: ✅  Deploy successful!
Preview URL: https://610e40ea.cloudflare-docs-7ou.pages.dev
Branch Preview URL: https://jphillips-do-gradual-deploym.cloudflare-docs-7ou.pages.dev

View logs

@github-actions github-actions bot added the product:durable-objects Durable Objects: https://developers.cloudflare.com/workers/learning/using-durable-objects/ label Mar 28, 2024
Copy link
Copy Markdown
Contributor

@irvinebroque irvinebroque left a comment

Choose a reason for hiding this comment

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

Merge conflicts then 🚀


Typically, your Durable Object Worker will define both your Durable Object class and the Worker that interacts with it. In this case, you cannot deploy changes to your Durable Object and its Worker independently.

[You are advised](/durable-objects/platform/known-issues/#code-updates) to ensure that API changes between your Durable Object and its Worker are forwards and backwards compatible whether you are using gradual deployments or not. However, using gradual deployments will make it even more likely that different versions of your Durable Objects and its Worker will interact with each other.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
[You are advised](/durable-objects/platform/known-issues/#code-updates) to ensure that API changes between your Durable Object and its Worker are forwards and backwards compatible whether you are using gradual deployments or not. However, using gradual deployments will make it even more likely that different versions of your Durable Objects and its Worker will interact with each other.
[You should](/durable-objects/platform/known-issues/#code-updates) ensure that API changes between your Durable Object and its Worker are forwards and backwards compatible, regardless of whether you are using gradual deployments or not. However, using gradual deployments will make it even more likely that different versions of your Durable Objects and its Worker will interact with each other.

Base automatically changed from gradual-deployments to production March 29, 2024 05:35
@deadlypants1973
Copy link
Copy Markdown
Contributor

This PR seems to be carrying over content that was already edited, reviewed and pushed last week on #13429 and rewriting it to its pre-reviewed state.

Does this need a rebase? @jp4a50

@jp4a50 jp4a50 force-pushed the jphillips/do-gradual-deployments branch from c06d7d2 to 795c5db Compare April 2, 2024 12:19
@jp4a50
Copy link
Copy Markdown
Contributor Author

jp4a50 commented Apr 2, 2024

This PR seems to be carrying over content that was already edited, reviewed and pushed last week on #13429 and rewriting it to its pre-reviewed state.

Does this need a rebase? @jp4a50

Yep, it was because I originally targeted the branch used for #13429 which was squashed, merged and deleted. I've rebased now.

This PR is ready to merge now as far as I'm concerned.

## Code updates

Code changes for Workers and Durable Objects are released globally in an eventually consistent manner. Because each Durable Object is globally unique, the situation can arise that a request arrives to the latest version of your Worker (running in one part of the world), which then calls to a unique Durable Object running the previous version of your code for a short period of time (typically seconds to minutes).
Code changes for Workers and Durable Objects are released globally in an eventually consistent manner. Because each Durable Object is globally unique, the situation can arise that a request arrives to the latest version of your Worker (running in one part of the world), which then calls to a unique Durable Object running the previous version of your code for a short period of time. If you create a [gradual deployment](/workers/configuration/versions-and-deployments/gradual-deployments/), this period of time is determined by however long your live deployment is configured to use more than one version.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Probably keep the "typiccally seconds to minutes" piece for the base case scenario

@Maddy-Cloudflare Maddy-Cloudflare changed the title Add documentation for gradual deployments for Durable Objects. [Durable Objects] Add documentation for gradual deployments for Durable Objects. Apr 2, 2024
@@ -0,0 +1,13 @@
---
pcx_content_type: navigation
title: Gradual Deployments
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
title: Gradual Deployments
title: Gradual deployments

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We usually capitalize Deployments elsewhere so leaving as-is.


Imagine that you have previously created 3 Durable Objects, [deriving their IDs from the names](/durable-objects/configuration/access-durable-object-from-a-worker/#derive-ids-from-names) "foo", "bar" and "baz".

Your Worker is currently on a version that we will call version "A" and you want to gradually deploy a new version "B" of your Worker.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
Your Worker is currently on a version that we will call version "A" and you want to gradually deploy a new version "B" of your Worker.
Your Worker is currently on a version called version "A" and you want to gradually deploy a new version "B" of your Worker.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'd like to leave this phrasing as-is to convey that this is just a made-up identifier, rather than the actual version ID.

Co-authored-by: Maddy <130055405+Maddy-Cloudflare@users.noreply.github.com>
@jp4a50 jp4a50 merged commit ebb1526 into production Apr 3, 2024
@jp4a50 jp4a50 deleted the jphillips/do-gradual-deployments branch April 3, 2024 16:42
title: Gradual Deployments
weight: 25

external_link: /workers/configuration/versions-and-deployments/gradual-deployments/#gradual-deployments-for-durable-objects
Copy link
Copy Markdown
Contributor

@irvinebroque irvinebroque Apr 4, 2024

Choose a reason for hiding this comment

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

adding this in DO docs was nice touch

deadlypants1973 pushed a commit that referenced this pull request Apr 4, 2024
…le Objects. (#13564)

* Add documentation for gradual deployments for Durable Objects.

* Address code review comments.

* Make Durable Objects gradual deployments example more concise.

* Fix broken links.

* Minor code review.

* add diagram and link

* Apply suggestions from code review

Co-authored-by: Maddy <130055405+Maddy-Cloudflare@users.noreply.github.com>

---------

Co-authored-by: Tanushree Sharma <tanushree@cloudflare.com>
Co-authored-by: Maddy <130055405+Maddy-Cloudflare@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

product:durable-objects Durable Objects: https://developers.cloudflare.com/workers/learning/using-durable-objects/ product:workers Related to Workers product size/s

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants