yunsii / cf-worker-status-page-pro

Monitor your websites, showcase status including daily history, and get notification whenever your website status changes. Using Cloudflare Workers, CRON Triggers, and KV storage.
https://cf-worker-status-page-pro-production.yunsii.workers.dev/
16 stars 3 forks source link

Consider using d1 as storage backend rather than kv #6

Open Enter-tainer opened 2 months ago

Enter-tainer commented 2 months ago

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 commented 2 months ago

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 commented 2 months ago

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.

Enter-tainer commented 2 months ago

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 commented 2 months ago

Yes, I will migrate to Pages firstly 😏

Enter-tainer commented 2 months ago

that's fascinating! waiting for your codeπŸ₯°

yunsii commented 2 months ago

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 https://github.com/yunsii/cf-worker-status-page-pro/issues/5 firstly.