11

I'm trying to scale our web application (PHP, MySQL, memcache) in a multi-region scheme. Currently we are using a setup with two EC2 instances behind an ELB and an RDS instance, all of them in US-EAST (Virginia) region.

We would like to have a presence in the EU (Ireland) region as well. This means at least a new EC2 instance there (identical to the others, serving the same application).

I have copied the desired AMI, setup the new instance, setup a same ELB configuration (required for SSL termination) and configured latency-based routing in Route53. And it works as suggested.

But, clients from EU have speed problems. This is due to the fact that the EU EC2 instances connect to the US-based RDS instance. As far as I know Amazon has not yet enabled RDS multi-region replication.

Do you have any suggestions on how to properly speed up the whole setup while using the single RDS instance?

Also, any ideas in general on how to scale things up? Ideally we would like to continue using the RDS technology for various reasons. Nevertheless, I am open to suggestions (I guess the next idea would be to host our own MySQL servers).

Ion
  • 278
  • 2
  • 3
  • 10

5 Answers5

5

You should think carefully why you need to have the same data in both US and EU. After all these are different users.

Running in a multi-region environment is much more complex and usually giving back performance due to the inherent latency between US and EU.

Even if you move out of RDS and try to replicate your data between regions, either asynch or synch, you will get latency issues that will give bad performance to your users.

The easiest way is to set up a dedicated RDS server in EU and share nothing between these instances.

Guy
  • 306
  • 1
  • 5
  • Hello Guy, the issue here is that EU and US customers need to have access to the same data. Is there any workaround/idea? – Ion Jun 03 '13 at 06:41
  • How often this data is updated (if not often you can easily replicate it between regions)? – Guy Jun 03 '13 at 09:00
  • The data are updated often in general. And they will start to be updated more often as the application grows in users. I think we have to look for some other solutions. – Ion Jun 04 '13 at 13:46
4

RDS is great for single-region deployments because of the low latency, but it becomes a different story when you start expanding to the different regions. If you want to keep the RDS instance, you could set up your own MySQL server in the EU region and do replication. This way, the speed will be far more acceptable.

Nathan C
  • 14,901
  • 4
  • 42
  • 62
  • 1
    Is there any (semi)automatic way to replicate an RDS instance in an interval? Any ideas? I suppose this replica would be read-only as well, right? – Ion May 28 '13 at 11:55
  • AWS supports read-replicas by default, that's correct: http://aws.amazon.com/rds/faqs/#86 - I'm sure it's possible to do read/write replication but that's outside the scope of SF (I'd check with our DBA site). – Nathan C May 28 '13 at 11:59
  • Yes, but the read-replicas are created in the same region. We need a read replica in a different region, and last time I checked they don't support this. – Ion May 28 '13 at 12:10
2

Recently, AWS made a move towards the direction I had previously asked about in my question by announcing cross-region RDS read replicas. However, this is only a small step towards a true multi-region setup.

Ion
  • 278
  • 2
  • 3
  • 10
1

I believe this is what you want. RDS replication to EC2 running mysql in a different region.

https://aws.amazon.com/about-aws/whats-new/2013/09/05/amazon-rds-new-data-migration-capabilities-mysql/

user195585
  • 11
  • 1
  • Welcome to Server Fault! Whilst this may theoretically answer the question, [it would be preferable](http://meta.stackexchange.com/q/8259) to include the essential parts of the answer here, and provide the link for reference. – slm Oct 19 '13 at 19:07
  • Thanks, seems interesting! This is a more relevant link: http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/MySQL.Procedural.Exporting.NonRDSRepl.html – Ion Oct 23 '13 at 08:40
0

One possible solution to improve latency could be to use Amazon ElastiCache (which is basically Memcached under the covers).

You would have to create an ElastiCache Node in each region (US-EST and EU) and have your application logic (EC2) use the cache node whenever possible. If you go this route you will have to re-architect your application 1) know what to cache and when and 2) to grab as much as possible from the local ElastiCache Node.