How to scale a website, Google App Engine, Amazon Web Services or other
Posted on 2014-03-27
First of all I'm quite new to all this and may have some misconceptions.
I have a website (Linux, PHP, Apache, MySQL) that runs on a small managed server (I can somewhat setup a server but don't feel comfortable running it all by myself). It's a small browser-based game where people manage their own soccer team and play against each other. At specific times during a day cron runs a php script that plays all the games (thousands), evaluates transfers and such. It can take quite a while (up to 40 minutes) and is quite taxing for the server so we display a simple message to users and don't allow them to do anything else. After this is over up to 200 users are logged in at the same moment to check their results and the server is noticably slower for an hour before it subsides to normal levels.
At this point I've decided to start over, completely rewrite the code and try to market it a lot more. In the future it should be able to handle 10x the workload and more.
However, I have no idea how the architecture behind all this should look like and I probably don't have the money to have it done for me. If it's going to be 10x more taxing it'd take 400 minutes to simulate all the games and the server would be crushed by 2000 concurrent users. I obviously need a stronger server but also more than one. At that point it'd probably be good to separate database, all the simulations and webpage serving.
Since I'm not a pro and want to spend my time actually developing the game I'd like to have as much as possible done by the service I choose. Right now I'm looking at cloud-based services such as Amazon Web Services and Google Cloud Platform which allow me cheaply test whatever setup I decide to use.
My questions are:
What is the best service to use and exactly how do I make all the servers/instances work in unison? It'd probably need to be as automated as possible.
When there is 20000 games to be simulated and I want it to be done quickly how do I actually tell two or more servers they need to start doing something - access a database on a separate server, look at games that need to be simulated, then each taking their subset of games to simulate and finally upload the results back to the database?
If I needed more than one server for a database how do i connect them together to act as one?
Services such as GAE and AWS offer load balancing - they seem to be straight forward and easy to set up and can be a solution for many concurrent users accesing the website. Is there a similar solution that can distribute the games I need to simulate to other servers?
Is there some guide that would actually give me step by step instructions with examples?
Thank you for your help!