3 ms·
> If you can figure out how to use D1 as a frontend dev, you can use a hosted Postgres solution and get much more power and performance. After a cursory glance
by motorest 2y ago
> If you can figure out how to use D1 as a frontend dev, you can use a hosted Postgres solution and get much more power and performance.
After a cursory glance at Cloudflare D1's description and service limits, I was left with the impression that the usecases are not that of a generic RDBMS. I mean, the limit for each database is 10GB, and apparently a D1 database resides in a single location. Of course this means >200ms to even hit the server when requests don't come from the same data center.
Perhaps this is one of those things where a underperforming implementation is released to minimize time-to-market, and then they work on performance. However, for a distributed service this suggests to me that this solution only works as an ad-hoc storage of complex relational data for high-read, low-write scenarios, where you have Cloudflare Workers query D1 but either aggressively cache the response or store queries in Cloudflare KV to avoid the roundtrip cost.
- fastball 2y agoIt doesn't even work well for high-read/low-write scenarios, that was my issue with it. If I'm caching everything in Cloudflare KV anyway, why would I want to use a terribly performing SQL store for cold operations? Much better to just use a hosted postgres and cache things in CF KV if that isn't fast enough.
- arkh 2y ago> Of course this means >200ms to even hit the server when requests don't come from the same data center. What world are you living in? When using a European server from Europe I expect < 10ms ping. Less than 100ms for East coast server, less than 150ms for west coast ones. Only cases I'd expect more than 200ms (and not a lot more) is when hitting Australian servers.
- motorest 2y ago> When using a European server from Europe I expect < 10ms ping. I'm living in reality, where a globally available application needs to serve people all over the globe from Cloudflare's >300 data centers. This means a worker running in the same data center hosting your D1 databases might get ~10ms requests, but workers running on all other >300 data centers have to pay for the round trip to the primary data center whenever there is a cache miss. The question you need to ask yourself is how come you failed to notice that. Do you have a good grasp on what you are doing?
- arkh 2y ago> This means a worker running in the same data center hosting your D1 databases might get ~10ms requests This is already waaaaaay too much. Same datacenter I expect nano seconds round trips. Datacenter to a datacenter on the other side of the world? Maximum 300ms. It was what you expected of game servers two decades ago. I don't see what could eat more than a couple dozen ms on the server with current hardware to make a 10ms round-trip become "> 200ms" and consider this a service you'd pay for.
- manter 2y agoI think D1 actually requires multiple round trips, so the higher figures start to make some kind of sense. I read a blog post about this but can't find it now. I did find this [release note](https://developers.cloudflare.com/d1/platform/release-notes/#2025-01-07 https://developers.cloudflare.com/d1/platform/release-notes/...) though. They describe removing _at least_ two round trips back to the DC hosting the D1 instance.