Using HAProxy for load-balancing SQL Server 2008
Is it possible/feasible/reasonable to use HAProxy to load-balance three SQL Server 2008 database servers?
Here is our situat开发者_JAVA百科ion: we have two web servers that are load-balanced on Amazon EC2. We are currently using one production SQL Server 2008 DB server. That server is starting to get overloaded, so we would like to add two more DB servers, and implement a load-balancing solution.
In Amazon EC2, we are unable to use a Virtual IP address, which prevents us from being able to use Windows Network Load Balancing (NLB) or any other load-balancing method that requires a VIP.
Our application is read-heavy, but we are unable to separate reads from writes, so the load-balancing solution needs to account for this.
We are planning on using SQL Server's built-in replication feature to keep all three DB's current (we understand that there will be some lag time, but that is acceptable).
Any thoughts or suggestions are welcome, and thanks in advance for your help.
Yes this is feasible. I've tried it in labs and it works well.
If you have a large enough farm of web servers you can make the session sticky by IP hashing which will solve the replication latency problem. The load won't be as evenly spread but the load probably won't be that even anyway given connection pooling (presume you are using .NET)
and if you use merge as your replication topology the solution should - in principle - scale well and be resilient enough that you can take individual servers down for maintenance so long as you are able to handle the odd dropped connection at application level.
I'd be worried about how the write transactions make it to all of the SQL servers on the back end. You could try something like peer-to-peer replication, but that's a non-trivial setup.
精彩评论