I am at a loss as to where to look into next regarding some performance issues I am having.
I have a Yii developed application which has about 20 inter-related tables. It’s a fairly straight forward application with user tables, item tables, location, profiles, etc. All the tables have relations to other tables.
The site is very fast, and the Db queries all run extremely quick and the page loads fast when it’s only a handful of users using the site. I’ve started doing tests with openload to simulate loading with 20, 40 and 50 concurrent connections to my main index page.
My main index page has a lot of cached information and only performs 6 database calls (non cached) to retrieve a list of "items" and their relations (location, user, category) upon load. Once the site hits about 20 concurrent connections it starts to really hammer the CPU on the server.
Once I get to 40 and 50 connections the server starts to go down and apache becomes unresponsive.
At the moment I am on a Micro instance using Amazon Web Services. I ran a test and upgraded it to a Medium instance and while I was able to get a higher load, I would have thought I would be able to get more connections than that before maxing out.
As a bit of background, it’s a single Debian Linux server with Mysql and Apache, nothing else really worth mentioning on the server.
I’ve tuned it in the following ways:
Set-up APC for the PHP files,
Disabled debug mode
Have set-up APC cache for some of the database queries (including schema caching)
Is there anything else I should do? Obviously the load tool I am running is hammering the php scripts which isn’t really reflective of what user activity will be ongoing, however it is concerning that someone can bring my site to a grinding halt so easily.
I thought about a firewall solution to limit the amount of times users can access the site, but that’s more of a workaround rather than solving the root cause. What sort of limits should I be seeing with respect to max simultaneous user connections?
I appreciate any feedback or comments that anyone has…