So I run an online gaming website which was built using Laravel: https://egn-gaming.com/
I'm currently with Digital Pacific and the plan I'm on is a VPS with 4GB RAM and 4v CPU. I'm running Laravel version 5.4, PHP 7 and the latest version of MariaDB.
The site is relatively fast, however load times increase drastically when multiple users are accessing the site, to a point where you're waiting 5-8 seconds for a page to load.
Most of the content that is being served on the site is dynamic, user generated content that's coming from the database, so naturally there are a bunch of SQL calls being made on every page.
At 40+ concurrent users (via Google Analytics) my server load average jumps up to around 5.0-6.0, while my memory usage hovers between 3.2-3.5GB. At 60-70+ concurrent users it will jump up to around 10.0+ load average and 3.5GB memory, which is when the site begins to hang and become too slow to use. I use htop to get these stats.
I've reduced the amount of SQL queries being made to the database, which has definitely helped (it stopped my site from crashing under heavy load), however it's still not good enough.
I understand that it all depends on the content you're serving, so I'll let you guys know roughly what I'm working with. Using Laravel Debugbar I can see that most pages tend to load in .5 - 1.5 seconds. As for SQL calls, most pages are roughly 30-50 calls, with a few here and there that exceed 50 calls.
I can provide more details if needed.
I now have to upgrade to a managed dedicated server, which will cost me around $300 AUD extra per month. I'm happy to pay for that if it's going to solve my issue, but I'm just wondering if it's normal for me to be upgrading to a dedicated server this early, when I'm barely hitting over 100 consecutive users.
The reason I'm annoyed about this is because I actually used to run an older site, which was a bare bone PHP website that wasn't built with any frameworks: http://www.ausfifa.com
On my old site I could reach 150+ concurrent users and the site wouldn't slow down at all on $30 per month shared hosting.
I've gone from paying $30 a month and being able to handle 150+ concurrent users on a bare bones PHP website to having to fork out $450 a month to be able to handle 100+ users on Laravel. It sounds ridiculous when you think about it like that.
I will be making an effort to optimize the site as much as possible, but if I'm to expect 150+ users to eventually be visiting my site, I just think that any optimizations wont be good enough as long as I'm using Laravel.
My question is, is it normal for Laravel to be using up this many resources? Is a dynamic, database driven Laravel application simply too heavy for a VPS? Or is my site simply not optimized enough?
TL;DR: Is it normal for me to be forking out $450 AUD a month for a dedicated server just for my Laravel application to be able to handle 100+ concurrent users? Or is my site poorly optimized?