Multi-region databases?

isaac-hinmanPRO

5 months ago

Very excited to see first-class multi-region deployments:

https://railway.app/changelog/2024-12-06-multi-region-replicas

This is something that will set Railway head and shoulders above many competitors.

It should now be possible to deploy a stateless service across multi-region, and have it be load balanced by request geo, right?

That is great, but I wonder how it relates to databases. If we have us-west, us-east, and eu-west for our stateless API layer, but we still have a single region for database (Postgres), we haven't really solved the issue properly.

I have also seen the HA Postgres docs:

https://docs.railway.com/guides/postgresql#high-availability-postgresql-cluster

But are the replicas actually load balanced for reads?

Ideally we'd have a multi-region stateless API service, and then a multi-region HA Postgres cluster, which can service reads from non-primary replicas closest to the API service.

Awaiting User Response

3 Replies

5 months ago

Yes, you are correct for stateless workloads. For stateful workloads, you are correct, we would need to have multiple volume replication, which is something we don't have at the moment. This is why we have the HA templates to let you have those follower replicas be geo synced.

However, I think we can do something here- I am raising this thread to the developer of this feature but candidly I think we will need a lot of work to do on our storage story.

- Angelo


Status changed to Awaiting User Response railway[bot] 5 months ago


isaac-hinmanPRO

5 months ago

Thanks Angelo, this is what I figured.

However, not quite sure I understand this:

> This is why we have the HA templates to let you have those follower replicas be geo synced

Are you saying the followers can serve read requests and are load balanced via request geo? Or did I misunderstand this? My assumption was that the HA templates are multi-region for availability reasons, not for actually serving geo-load-balanced traffic.


Status changed to Awaiting Railway Response railway[bot] 5 months ago


5 months ago

You are correct, but you could, in-theory, modify the config where the shards are serving traffic and then you attempt to sync the state of the data post facto. (Easier said than done.)

Long story short, expect to see more of our Geo-HA offerings.


Status changed to Awaiting User Response railway[bot] 5 months ago