What method of MySQL mirroring should I use for this?

Posted by user45745 on Server Fault See other posts from Server Fault or by user45745
Published on 2010-06-14T21:47:31Z Indexed on 2010/06/14 21:53 UTC
Read the original article Hit count: 182

I'm running an web application hosting service (basically hosting forums for free), and I have two remote servers at my disposal. The code for the application is stored on both servers and isn't a problem, but I'm wondering how to deal with the databases.

When someone goes onto a site *.example-host.com, they are sent to one of the two servers and both must be capable of loading the forums from a database. The database must also have write access, for when new members register or post topics etc.

The main requirement is speed, but uptime is also important (if a server goes out, the site should still work).

I have a few options, but I'm inexperienced and not sure which to go with:

1) [PHP] Split the forum records 50:50 between the two servers. If a server does not have the record for a forum requested, it can request it from the other by remote MySQL and load it. This idea sounded okay, until I realised that 50% of the time, users would be waiting significantly longer for pages to load. I also realised that if one of the servers went down, half the forums would be inaccessible and registrations would have to be disabled.

2) [MySQL] Dual master replication. This would attempt to mirror the two databases and sounds perfect, but I've heard that it can be very problematic. I don't know how fast this is.

3) [MySQL] Use a standard replication, distribute read only queries on both nodes and read/write queries to the master. This sounds like a good option, but again, I'm not sure on speed. I also don't know what would happen if the master server went down.

If you have any other suggestions, please post them :)

© Server Fault or respective owner

Related posts about mysql

Related posts about load-balancing