So I have a DBMS, MySQL, installed on an EC2 c4.compute instance. The problem is that it can only handle up to 8 RPS, before reaching 100% CPU, and then having problems.

For a project, I need at least 20+ RPS. I think the storage (SSD) is not the problem, but the CPU just isn't powerful enough to handle that many requests. So logically, the solution would be to use more than one CPU/instance to handle the load. (I do not want to use a more powerful instance)

Is there a way to accomplish this with EC2+MySQL/MariaDB in a way such that queries from a PHP application do not experience noticeable slowdowns?

  • 1
    First, are you certain of your bottlenecks? Before moving to a load balanced multi-master database or similar, are you certain that your PHP application is not the problem? Some data would help in this, and would assist others in giving you a valid solution to your problem. – Spooler Feb 8 '17 at 15:40
  • Yes, PHP uses 5% CPU (they are separated) – Oo Dee Feb 8 '17 at 15:49
  • How long does your server take to process a single request in an ideal condition (server is idle and dedicated for the test)? Assuming a c4.large instance, which has only 2vCPUs, your request should not take more than 100ms "end to end". Even a rounded time of 100ms will degrade during peak load but it's a starting point to measure. If your requests need more than 100ms of avg. processing time, I am afraid that your only way to avoid capacity issues will be either optimize your application and queries, or granting more HW resources with a more capable EC2 instance. – ma.tome Mar 11 '17 at 16:12
  • check the EC2 instance monitor for RAM, I/O, cpu usage, etc . Sometime high I/O mean unoptimized DBMS, you need more index and optimize your query, instead of jump straight to load balancing. 8 request per seconds is not the issue, the issues is how you apps play along with the DB. – mootmoot May 5 '17 at 16:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.