Forum Discussion

JoshP_187840's avatar
JoshP_187840
Icon for Nimbostratus rankNimbostratus
Aug 27, 2015

Load Balancing Method Recommendations for MySQL?

I have a pool of 3 Maria MySQL nodes, replicated through Percona xtrabackup. I have them in the F5, but we've noticed that sometimes the replication isn't sufficient to keep up with our actual application. So, the problem was manifest when the pool was set to "Round Robin" - each connection came in and went to the next node in the pool, and the replication hadn't been able to keep up. Setting it to "Least Sessions" has a clear preference for the first server in the pool, but I know this isn't a guaranteed solution.

 

The application is running Django 1.5, and persistent connections are not possible at this point. Is there a way I can mimic (or prefer) the same node through the F5 (I'm thinking weighted ratio, but I don't fully understand dynamic ratio and some of the other options)? Is there another recommendation for MySQL?

 

3 Replies

  • Hi,

     

    I think you must configure Priority group activation with minimum of 1 member

     

    • Priority member 1 : 5
    • Priority member 2 : 3
    • Priority member 3 : 1

       

    • if member 1 is up, all connections will be sent to it

       

    • if member 1 is down and member 2 is up, all connections will be sent to member 2
    • if member 1 is down, member 2 is down and member 3 is up, all connections will be sent to member 3
  • Generally speaking, it's usually not a good idea to simply load balance SQL services. Assuming they're all storing the same data, you'll run into issues with replication if you're writing to different DBs frequently. You might want to consider setting up the servers in a priority group configuration. Give each server node a different priority value. The highest priority group will receive all requests until it fails, moving to the next priority group, and so on. You also want to put a decent monitor on the servers so that the LTM actually knows when a service has failed.

     

  • I will like to know if there is a possibility to set a rule like this

     

    • Priority member 1 : 1
    • Priority member 2 : 2
    • Priority member 3 : 3

    If member 1 goes down go to member 2, once member 1 comes back up I do not want f5 sending the connection to 1, I just want to switch only IF the member goes down.