Page 1 of 1

Multiple Servers - One Database (PHP)

Posted: Tue Sep 11, 2012 9:34 pm
by vitinho444
Hello community!

I was wondering, if i could improve my browser game's performance by using multiple servers ( free / non-free) hosts but all connected to my main website database, where all the information is held.

Is this possible with PHP and MySQL?

PS: I was thinking of this because if a chinese player wants to play my game that is hosted in the UK, it would be better to have a Chinese Server connected to the central DB in high speed, working as a middle man.

Re: Multiple Servers - One Database (PHP)

Posted: Tue Sep 11, 2012 11:36 pm
by Jackolantern
Most definitely :) It is an entire aspect of server and database administration called "clustering". Any server or database that is expected to work for companies in an enterprise environment must be able to support clustering.

I have never done this with Apache web server before, but I know it is possible. People would make a request to your main IP address, and then...something...would decide which Apache server to send the request to. I actually don't know what that something is though haha, but it is probably all done within Apache. But sharing a database is easy. In PHP you select where the database server is you are connecting to. WAMP and XAMPP automatically set it to local host, but you would just change it to the IP address of your database server. Of course you would probably need to cluster the database since the database is oftentimes a larger bottleneck than Apache and the PHP module.