Optimizing latency between application server (EC2) and RDS


HI, here's how the story goes.

We started transforming a monolith, single-machine, e-commerce application (Apache/PHP) to cloud infrastructure. Obviously, the application and the database (MySQL) were on the same machine.

We decided to move to AWS. And as the first step of transformation, we decided to split database and application. Hosting application on a c4.xlarge machine. And hosting database to RDS Aurora MySQL on a db.r5.large machine, with default options.

This setup performed good. Specially the database performance went up high.

Unfortunately, when the traffic spiked up, we started experience long response times. Looked like RDS, although being really fast for executing queries, wasn't returning results fast enough over the network to the EC2 machine.

So that was our conclusion after in-depth analysis of the setup including Apache/MySQL/PHP tuning parameters. The delayed response time was definitely due to the network latency between EC2 and RDS/Aurora machine, both machines being in the same region.

Before adding additional resources (ex: ElastiCache etc) we'd first like to look into any default configuration we can play around to solve this problem.

What do you think we missed there?

    1. Can you share measurements of the unacceptable latencies you were seeing? 2. You say the server and DB instance are in the same Region... are they also in the same Availability Zone?
asked 2 years ago849 views
1 Answer

Hi ,

Can you try using RDS proxy to call the RDS ?

It performs some optimisations in terms of performance, availability , security etc. Refer : RDS_PROXY

If possible, please try to provide some details like how you are calling the RDS for better understanding.

answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions