Advice on React application with Laravel API as a backend that uses MySQL for the database

Posted August 19, 2021 164 views
MySQLPHPReactDigitalOcean Managed MySQL DatabaseLaravel

I currently run a site that hosts about 20,000 total users with 5,000-20,000 page views per day depending on what time of week/month. Right now I’m running it with Laravel/PHP/MySQL on Ubuntu LAMP on 18.04 droplet ($40, 2CPUs/4GB/256GB Disk). It has been working decent, but if the traffic gets too high, the site will lock up. Most of the time this lock up is due to MySQL taking up 100% of the processes.

I’m wondering if it would be worth it for me to switch over to DO’s Managed Databases? I haven’t used it before, but it looks like it would be able to handle MySQL if it gets too loaded?

Also, how would that work? I have 3 separate droplets? 1 for react, 1 for laravel api, and one for the managed database?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

If you can, I’d advise to try figuring out “why” the DB locks up to begin with. It might be the sheer concurrency, or there maybe conditions in which very slow requests are generated, or it may be that you’re hitting the disk and are limited by IO.

Solutions can be drastically different depending on “why” it’s slow. At present time, you seem to assert that “more power” is the solution, and it may alleviate the problem, but maybe not optimally.