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 as storage backend rather than kv #6

Open
Enter-tainer opened this issue Sep 7, 2024 · 7 comments
Open

Consider using d1 as storage backend rather than kv #6

Enter-tainer opened this issue Sep 7, 2024 · 7 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@Enter-tainer
Copy link

https://developers.cloudflare.com/d1/platform/pricing/

cloudflare launches d1 recently. It is a cloud native sqlite solution. The free tier allows 100000 writes per day. This is 100x more than kv.

I think we can create a table with only 2 columns, one for key, the other one for value. So we can still expose a kv interface. So we only need change https://github.com/yunsii/cf-worker-status-page-pro/blob/master/src/worker/_helpers/store.ts

@Enter-tainer
Copy link
Author

https://developers.cloudflare.com/d1/platform/limits/ One thing to notice is that the max row size is 1MB. This is smaller than kv.

@yunsii
Copy link
Owner

yunsii commented Sep 7, 2024

Furthermore, support to switch storage solution (KV/D1/R2) is a better solution, I migrated the storage to R2 in my company 😂 and it is low priority for now, but PR is welcome.

@yunsii yunsii added enhancement New feature or request good first issue Good for newcomers labels Sep 7, 2024
@Enter-tainer
Copy link
Author

r2 is pretty cool. It also has large r/w quota. And it has a much higher limit for object size.

I migrated the storage to R2 in my company 😂

Just being curious, will you open source relevant code here?

@yunsii
Copy link
Owner

yunsii commented Sep 7, 2024

Yes, I will migrate to Pages firstly 😏

@Enter-tainer
Copy link
Author

that's fascinating! waiting for your code🥰

@yunsii
Copy link
Owner

yunsii commented Sep 8, 2024

After I tried, Cloudflare Pages does not support Cron Triggers for now.

I think it is so complicated if used with another separate worker, so I decided to wait for its support 😂 And try to support #5 firstly.

@JoyceBabu
Copy link

You should enable Smart Placement when using D1, or else the requests will be painfully slow when the worker node is at a different location from the D1 node.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants