0

I have an RDS Aurora MySQL 5.7 and a number of independent applications connected to it. Some of them are real-time websites while others are batch services (connected mostly to the reader). A recent event resulted in a spike in sessions and took down the writer. We suspect it was one of the batch jobs.

My question is, is there a way to limit the amount of resources/connections/sessions per MySQL user or database? If not, is there anything better to do other than creating a separate RDS for every application to make sure one doesn't take down the rest?

Thank you

Leo
  • 435
  • 1
  • 4
  • 7

1 Answers1

1

You can define resource options per MySQL user and each application should use their own credentials.

  • MAX_QUERIES_PER_HOUR
  • MAX_UPDATES_PER_HOUR
  • MAX_CONNECTIONS_PER_HOUR
  • MAX_USER_CONNECTIONS

Example:

ALTER USER 'john'@'%' WITH MAX_QUERIES_PER_HOUR 90;

More details: Setting Account Resource Limits

Although this will limit the impact across applications, it will start failing once it hits these limits. If systems are truly independent and you don't have resource contraints, to reduce the blast radius ideally you'd create separate databases as you suggested to make sure there is no impact between each application, move towards a microservice architecture.

Erico
  • 156
  • 2
  • 12
  • Thank you Erico this is so helpful! We do actually utilize a microservices architecture bu are connecting to the same database - creating an RDS for every small service is very costly. Wo wonder what other approaches are there. – Leo Nov 11 '20 at 12:15
  • 1
    No problem. I agree there is not really a perfect approach, it's about meeting your requirements, how much $$$ you can spend and the risks you can accept. In RDS I don't think there is really another alternative. A single instance can't be divided with resource limits like containers. – Erico Nov 11 '20 at 17:54