1

We have a multi-tenant setup where each client of ours runs a DB that is identical to every other client. We were using Mysql sofar and with CentOS 7.x ,switched to MariaDB.

If we want to distribute the load so that requests for Databases 1-500 go to Node-A, request for Databases 501-1000 go to Node-B, would that be possible through some out of the box solution like haproxy? I looked into their documentation but the "balance" options seem to be about distributing the load based on pre-defined headers/values rather than my use-case above. Would it be possible to add a custom "balance" algorithm that will send the requests to the corresponding nodes?

The other approach I was considering was to use a local key-value store that contains the information about which clients are in which Node and switching to those based on the request. I also want to have master-slave replication for these, but have already handled that through a proxy in my application.

Our application runs on PHP(Symfony Framework) with Mysql, if that matters.

How would you design a system that will have few thousand databases and be able to spread the load?

  • @Erik, Im trying to find out how to spread the databases between multiple database servers and access them through something like a Virtual IP. The application already knows which DB to talk to based on the client, so thats not a problem, but right now, they all talk to a single database server. If we were to grow, that means putting a group of DBs in a different server or moving the most loaded DB into another server. I dont want to write something custom for this, so was wondering what would be a better approach for this. – rajasaur Nov 2 '15 at 18:37
  • Check out MaxScale. – Rick James Dec 4 '15 at 21:01
0

You can use Galera for multi-master replication. If you could move individual clients to specific nodes you will not run into locking issues. It also has automatic recover of failed nodes. http://galeracluster.com/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.