5 ms·
This is not a fly.io specific question but I always wonder how in these globally distributed system, how are databases handled? I understand you can put your a
by acidity 5y ago
This is not a fly.io specific question but I always wonder how in these globally distributed system, how are databases handled?
I understand you can put your application server in any location but generally there is only one storage so are these application servers doing cross region database calls?
Having only worked with single cluster setup web apps, I am always curious about this part.
Is the answer always - use a managed replicated database and send read queries to one near your location and all write queries goes to the primary instance?
- mrkurt 5y agoThat's our answer, yes. Read replicas and we redirect requests that need writes to a "primary" region: https://fly.io/blog/globally-distributed-postgres/ https://fly.io/blog/globally-distributed-postgres/ We tried cross region database calls for HTTP requests. They were bad. They seem to work ok for long lived connections like websockets, though.
- deleted 5y ago[deleted]
- lawik 5y agoUsing something like CockroachDB you should be able to avoid the single-writer situation. It has it's own complexities I'm sure but seems very compelling.
- matthewcford 5y agoWould need to commercial licence for this to work though