How are databases for distributed applications scaled?

Hello,

This question isn’t specific to using Rancher. It’s just a general question. I’m trying to understand how applications scale across AWS regions. The part that I don’t get is the database. For example, if I have a Laravel app with a MySQL database that’s running multiple instances in different AWS regions, how does the database stay up to date? Do I need a database that supports clusters? How can that prevent accounts being created with duplicate Id’s on different instances? Should I use glusterFS with a database on top of that?

Note: I’m not trying to solve a real problem yet. This is just something I’d like to understand. I suppose I could forget this complicated part and just use an AWS database. But that’s not the point for me.

Thanks.

I think you can get very far using multiple Availability Zones in the same AWS region. While it is a very nice engineering problem, make sure your organization really needs it.

Eventual consistency, sharding and CAP theorem you should read about. I don’t think a single clustering DB technology, or a cluster filesystem will solve all the issues that come from latency between AWS Regions.

Thanks. I didn’t realize it was such a hard problem…just something I didn’t quite get. I’ll look into the topics you listed.

I was hoping someone who new at least one way to accomplish this would share an answer. To double check, I’ve assumed that AWS database options provide this already. Can you confirm if that’s correct or not?

To my knowledge it only replicates within one region to multiple AZs. Did a quick look and it’s still the case. But to be sure, check this out: https://aws.amazon.com/rds/details/

In addition to normal MYSQL, AWS provides their own MySQL compatible managed database service called Aurora. This option does have an easy and well supported method of creating a fairly low latency read-replica in other regions, but as @laszlocloud mentioned, cross-AZ replication is the primary means of high availability for most applications.