1

MongoDB vs MySQL, Master-Master or Master-Slave?

I’m currently developing a service in Laravel for online learning. Basically imagine Memrise.com.

Now, my users are going to be doing lots of reads and writes. The writes are going to be small, with 4 ints, 1 string (approx. 30 chars) and a bool (statistics for answered questions by my users). The reads on the other hand will at most be texts of at most 1000 words, together with 1 question (~20 words) and 4 options (~20 words). The PHP is not very advanced. I have implemented SuperMemo 2, however it’s not going to be much more resource intensive than that.

When I’m launching the site, I’d like to have the possibility for 500 simultaneous users (reading and writing simultaneously), and while I do have moderate experience in managing servers as a hobby, I’ve never actually launched anything for production.

The most important factor in the server setup that I’ll be starting off with is that it should be very scalable. I’m (probably) going to be using Linode because of their location, performance and reputation. My budget to start off with is going to be $120/mo (for 500 users) but I want it to be able to scale horizontally easily and fast if needed.

What I’m actually wondering is what my base server setup should look like (hopefully with the capability of being able to withstand 500 simultaneous users). Should I use a MongoDatabase for the user answers(writes) and a MySQL DB for their accounts? Should I go with just MySQL and some sort of replication? Should I use Master-Master or Master-Slave? What should the Redis setup look like? How should I divide my resources to get the maximum bang for the buck?

I’m currently considering the following setup:

  • 1 Linode Load-balancer ($20)
  • 2 Nginx + PHP-FPM backends (2 x $20)
  • 2 MySQL Servers (2 x $20)
  • 2 Redis Cache Servers (2x $10)

I’d like to be able to just add on more servers as needed without any down time (I realize that the Load balancer is a weak spot but that’s fine).

Now, later on I’ll be able to spot weak links in my setup but I just want to make sure that I’m prepared in the beginning for decent load.

Thanks in advance, Axel

0 Answers0