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

Consider using D1 instead of DO storage #4

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

cometkim
Copy link
Member

Previously, as an implementation strategy for persistent state, I introduced DO and event sourcing.

Also described it may provide better flexibility. And at the time, D1 wasn't such a good option.

I changed my mind after seeing this announcement today.
https://blog.cloudflare.com/d1-turning-it-up-to-11/

It now JSON features and time travel recovery. A very reasonable pricing policy is also included.

What DO still does better is its lower access cost and actor model. It allows for more aggressive distribution model and elasticity if we don't want distributed transactions or something (indeed it is very difficult)

The SQL frontend definetely will provide better DX and operational convenience.

The only blocker is that it doesn't yet provide Rust bindings, but that will probably be there soon.

cloudflare/workers-rs#270

@cometkim cometkim requested a review from kyoungduck May 19, 2023 13:38
Copy link
Collaborator

@kyoungduck kyoungduck left a comment

Choose a reason for hiding this comment

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

I love D1

SQL is better interface

@FlareLine
Copy link

Great contribution considering the D1 implementation is now under review.

One question I would ask is whether it's useful keeping the option for DOS as a persistent storage mechanism in the documentation - I would argue that it's still a reasonably viable option?

@cometkim
Copy link
Member Author

@FlareLine Assuming that most of the states we'll be dealing with are kept simple, DOs are still a useful option.

However, the main reason for choosing D1 is better maintainability. Using DOs needs careful migration strategy. It might be event sourcing, but it adds implementation complexity.

I don't think we need to use multiple tools for the same purpose.

Also JOIN might be useful at some points.

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.

3 participants