Lets say I have Spring Framework App that is running on Tomcat and uses MySQL database:

enter image description here

What would be the best solution in this instance that would allow for sociability (price/performance/integration time)?

More precisely: What would be on the Web Load balancer box, and who should be the tomcat web server clustered? What would be on the Database Load balancer box and how should be the database servers clustered? And if at all possible specific technical integration links would be of great help.

  1. For web load balancing, there are multiple solutions, opensource and paid, I personally have used cisco load balancers(CSM and ACE) and F5 and like them(but those solutions can get expensive). There are multiple for opensource, one that comes to mind is http://www.linuxvirtualserver.org/

  2. For mysql load balancing, you can look at master to master replication for msyql. Look at: http://www.howtoforge.com/mysql_master_master_replication. What I have done in past for a project, I had 3 web servers serverfarm behind big IP(F5) and they all talked to one mysql server. And I had exact same setup in a different site, and both mysql servers had master to master replication. So users would use all the webservers and db servers and if one of the DB server, went down, web farm on that site would go down and users would only use the other site. (DNS failover and monitoring for multiple site monitoring and failover). You can use global load balancer if you have the budget to get more granular.


Plain MySQL does not have a load-balancing option, but MySQL Cluster does.

I would recommend using MySQL Cluster for your multiple MySQL instances.

Then you can use MySQL Connector/J with transparently load-balancing JDBC URLs. See http://dev.mysql.com/doc/ndbapi/en/mccj-using-connectorj.html

PS: I voted to move this question to ServerFault.com.


I would not recomend using MySQL Cluster. I have never seen it perform well and not crash alot. Havent used it in a while though (since it didnt realy work a year or so ago).

Simply use a master with slaves. Do al your read operations on the slaves (unless you need to read your own writes or data current to the ms). If that doesnt scale enough for you (you have to many writes). It is time to look at sharding.

Another option, if your application allows it (or can be turned into allowing

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.