Page on cloud server setup takes much longer to load than on physical server
Posted on 2012-08-16
I have a physical server that runs LAMP setup all on the same machine. I have a page that pulls a lot of data from the server to build a page. On this machine building the page takes about 11 seconds.
I have two cloud servers (specs are better than the physical server as far as processor and memory) one is the webserver one is the mysql server. These servers are connected via local network connection. Building the same page takes about 4 minutes on this setup.
I have narrowed down the issue to part of the page gets a list of materials, and then also all of the categories that material belongs to. So in this case it does one query to get 480 materials and then 480 queries to get their respective categories. On the first server, this takes almost no time at all, on the cloud setup this is taking about 20 times as long. Is this because the server running the PHP and the server Running MySQL are on separate servers, and there is more overhead?
Since these pages are cached and only rebuilt as needed it isn't a huge issue, I just don't like the discrepancy and am concerned as to why it is happening. We moved to the cloud and this distributed setup because we expect a huge increase (200 to 300 thousand) in users starting in about two to three weeks based on new subscriptions we have received and need to be able to scale up as needed to handle the traffic.