litefs icon indicating copy to clipboard operation
litefs copied to clipboard

Support for per-database primary on different nodes (regions)?

Open mattbnz opened this issue 10 months ago • 3 comments

Would it be possible for litefs to manage primary status on a per-database rather than per-node basis to enable different databases within the same application (e.g. one database per SaaS tenant) to prefer their primary in the region that is closest to their primary users but still allow replication/failover if that region fails?

AFAICT from a quick skim of the code the "node is primary" concept seems pretty heavily baked into a lot of the code, so I suspect the answer is not easily - but I also don't see any fundamental reason or constraint on why it should be at the node level, rather than the database level (maybe # of consul leases is a consideration at some scale, but not for a while) - given how useful this type of functionality could be vs the alternative of having to run multiple different litefs instances/clusters for each "primary" region otherwise.

Thoughts?

mattbnz avatar Oct 15 '23 10:10 mattbnz