Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Load balancing databases
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

Load balancing databases

squibssquibs Member

I'm able to use a load balancer to distribute load over several webservers, but am now looking to do the same with database. Anybody know a good resource for setting this up with mysql/mariadb and keeping everything in sync?

Comments

  • jadenjaden Member

    Digital Ocean's guide on master-master replication is pretty good.

    If you don't want to mess with replication, you could set up a single DB server that all of the web servers use. It lets you scale out the web servers horizontally and you can go pretty far with that configuration.

  • I have done this on iwstack 3 Instances of maridb master-master replication and 1 Instance for cluster controller and deployed with severalnines.com.

  • BruceBruce Member

    depends on what application you have too. not done it personally, but you can split the tables onto 2 or more servers. means you have to code for different DB connections though

  • squibssquibs Member

    @Bruce Thanks for that - is my vision of a large multi node distributed replicated database a pipe dream? I'm sure it's hard and fraught with difficulties, but surely some people are doing it? Or maybe they just throw resources at one giant monolithic db server?

    @SoftGeeks bizarrely enough I'm on IWstack myself and have outgrown their largest 16gb node. Severalnines looks really interesting - thanks.

  • @squibs said:

    is my vision of a large multi node distributed replicated database a pipe dream? I'm sure it's hard and fraught with difficulties, but surely some people are doing it?

    Guess what happens when your query needs to "join" stuff from different machines... You want to do sharding but also modify your code & data model accordingly.

  • Why not use two MySQL servers (master & slave) and put them in a roundrobin array?

  • @TinyTunnel_Tom said:
    Why not use two MySQL servers (master & slave) and put them in a roundrobin array?

    What would happen if a write query hit the slave? ;)

  • @deadbeef said:

    Presuming it's something that doesn't require write. Or write can be used on a diff file eg admin area

  • deadbeefdeadbeef Member
    edited May 2015

    @TinyTunnel_Tom said:
    Presuming it's something that doesn't require write. Or write can be used on a diff file eg admin area

    Master-slave replication + load balancers is used when you need to scale your reads. You have to adapt your code accordingly. That said, I don't think that's what the OP is asking (scaling reads only).

  • You need to decide whether you are scaling reads or writes (as @deadbeef states). If its just reads then master + slaves will help.

    What database are you using?

    Thanked by 1deadbeef
  • blackblack Member

    I've been playing around with Cassandra, it's worth checking out.

    Thanked by 1inthecloudblog
  • Interesting article just to have some superficial knowledge for guys who don't deal with NoSQL (me)
    http://kkovacs.eu/cassandra-vs-mongodb-vs-couchdb-vs-redis

  • pkr5770pkr5770 Member
    edited May 2015

    setup mysql cluster, create data nodes for the heavy lifting and turn the webservers into an "api node" these are interfaces for the data nodes and behave like regular mysql servers.

    Here's a starting point: https://cyrenity.wordpress.com/2010/08/12/howto-setup-mysql-cluster-beginners-tutorial/ We were testing these technologies over geographic locations but obviously the closer the server is the better as for example a select query will get parts of the data from each of the data nodes. (we got around this by using multi-master circular replication i.e clustering clusters).

    The mySQL Cluster will run in memory as well so that will be a performance gain straight away if you are not already using in memory databases.

    • Load-balancer/DNS failover + Multi-master mysql replication + ample RAM can go a long way (assuming your apps can work in this configuration)

    • You'll need to stay on top of replication issues via monitoring scripts, etc

    • Dependent on various factors (traffic, latency, bandwidth, CPU, disk throughput, etc) you can probably do <= 10 geographically distributed nodes with satisfactory results.

    YMMV

  • squibssquibs Member

    Thanks all - some great responses there. I have some reading to do.

  • tomletomle Member, LIR

    Do several servers, one for writes and 1+ slaves for read in a master slave setup. This will allow you to scale your DB servers a lot if you're not in a write heavy environment.

    If you use functions for your reads/writes it's easy to change in the code.

  • ditlevditlev Member, Top Host, Host Rep
  • squibssquibs Member

    @ditlev - that looks really interesting. Thanks.

    The reading I'm doing on master-master setups suggests that they don't scale well. Anyone got any experience with master-master or master-slave setups in prduction environments? Don't worry - I won't bug you for setup tips, I'm just interested in anecdotal experiences of how well both setups scale.

  • squibssquibs Member

    @MarkTurner Sorry - missed your question. It's MariaDB supporting a Magento store. As far as I can tell, Magento only supports Master-Slave natively, so master node/writes will be the weak point, but writes should be much rarer than reads.

  • Use SeveralNine's tool for quick fast deployment:

    http://www.severalnines.com/clusterconfigurator

    I haven't used it for a few years, but it was good for a fast solution

    Thanked by 1Bruce
  • squibs said: It's MariaDB supporting a Magento store.

    Also have a look at LiteMage:
    http://www.litespeedtech.com/products/litemage-cache/overview

  • ditlevditlev Member, Top Host, Host Rep
    edited May 2015

    I always thought that a scalable mysql setup (ideally served as a service) is the holy grail. We've tried to buy Xeround and GenieDB in the past, but it either didn't fit, or didn't work - so we're still looking.

    Everyone is talking about NOsql, but 97% of all front facing DB's are currently MySQL. While the tech is old, it's the tech being used - and someone needs to solve this problem.

    :)

    D

  • @ditlev

    Google CAP theorem and keep your hopes low ;)

  • Why load balance infact. Just scale up

Sign In or Register to comment.