Wagner Tsuchiya
Wagner Tsuchiya

Reputation: 138

AWS read replicas architecture

We have a service that runs in 6 AWS regions and we have some requisites that should be met:

The architecture that we discussed was having one service that updates the master db and one slave in each region (6 slaves total).

We found some problems and some possible solutions with that:

  1. There is a limitation of 5 read replicas using AWS infrastructure.

To solve this issue we though of creating read replicas of read replicas. That should give us 25 instances.

  1. There is a limitation in AWS that you cannot create a read replica of a read replica from another region.

To solve this issue we though of inside the application updating 2 master databases.

  1. This approach will create a problem that, for a period of time, the databases can be inconsistent.

In the service implementation we can always recreate the data. So there is a job re-updating the data from times to times (that is one of the reasons that the update is IO intensive).

Anyone has a similar problem? How do you handle it? Can we avoid creating and maintaining databases by ourselves?

We are using MySQL but we are pretty open to use other compatible DBs.

Upvotes: 1

Views: 501

Answers (2)

Hal Berenson
Hal Berenson

Reputation: 351

You can request an increase in the number of RDS for MySQL Read Replicas using the form at https://aws.amazon.com/contact-us/request-to-increase-the-amazon-rds-db-instance-limit/

Once the limit has been increased you'll want to test to make sure that the performance of having a large number of Read Replicas is acceptable to your application.

Hal

Upvotes: 0

Tom
Tom

Reputation: 2888

unfortunately, there is no magical solution when it comes to inter-region: you lose latency.

I think you explored pretty much all the solutions from an RDS point of view with what you propose, e.g read replica of read replica (I confirm you cannot do this from another region, but this is to save you from a too high replica-lag).

Another solution would be to create databases on EC2 instances, but you would lose all the benefits from RDS (You could protect this traffic with an inter-region vpn between vpcs). Bare in mind however that too many read replicas will impact your performances.

My advises in your case would be:

  • to massively use cache at every possible levels: elasticache between DB and servers, varnish for http pages, cloudfront for content delivery. If you want so many read replicas, it means that you are heavely dependent on reads. This way, you would save a lot of reads from hitting your database and gain latency significantly, and maybe 5 read replicas would be enough then.
  • to consider sharding or using several databases. This is not always a good solution however, depending on your use case...

Upvotes: 2

Related Questions