3 ms·
Something I'd love to understand is the latency model for hosted databases like this. Every production web app or backend I've worked on has pretty much depende
by danpalmer 2y ago
Something I'd love to understand is the latency model for hosted databases like this. Every production web app or backend I've worked on has pretty much depended on having 1-3ms latency to the database. That's easy when you're deploying your own hardware, and in my experience easy when you use a cloud provider's hosted offering in the same zone, and fine within the region.
So how does this work? I sign up and get a Postgres connection string. Where is it? Because the where _really_ matters. Do Xata and the other examples of this all deploy into all the cloud providers and all the regions and let you choose which one? That feels like a big duplication of effort and like it would be harder to get critical mass in order to get the unit economics to work. Or do people just put up with a database 10ms away?
- scosman 2y agoEvery one I’ve used is on AWS and will tell you the zone so you can keep things within the region/zone. That includes Heroku, Supabase, Neon, and (obviously) RDS. That said, I’ve used AWS DBs with Cloudflare pages and the latency isn’t a major issue. If you are running non geo-distributed DB, the DB is a lot further than 10ms away from your average user.
- danpalmer 2y agoIn my experience, applications tend to do far more DB queries than users do backend requests, and as such, 50ms to the user matters much less than the difference between 1 and 10ms on DB queries. That said, thanks for the experience. Do they also tend to launch in other cloud providers? It seems like it would be a tricky business to navigate, restricting your customer base to specific providers.
- Kwpolska 2y agoSome SaaS providers will let you choose your cloud and set up their services there. As for the latency, it might not matter for all applications, or it may encourage the devs to spend more time optimizing the number of SQL queries.
- skybrian 2y agoThey let you choose a region. Here is Xata’s region list: https://xata.io/docs/getting-started/available-regions https://xata.io/docs/getting-started/available-regions Looks like it’s using AWS Aurora under the hood: https://xata.io/blog/serverless-postgres-platform https://xata.io/blog/serverless-postgres-platform But also, they’ve done some work to reduce the number of network round trips that Postgres needs to respond to a query. For many situations, SQL over HTTPS is used. In JavaScript, the database driver is a wrapper around a fetch request. Xata seems to have its own SDK with higher-level API’s to reduce round trips. Also: https://xata.io/blog/geo-distributed-postgres https://xata.io/blog/geo-distributed-postgres Meanwhile, here’s Neon’s blog post on their connection options: https://neon.tech/blog/http-vs-websockets-for-postgres-queries-at-the-edge https://neon.tech/blog/http-vs-websockets-for-postgres-queri...