Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using 3.5 and SQL server 2008 and want to setup a very simple web farm.

I have purchased 2 VIRTUAL servers, I DO NOT use viewstate or sessions on my webpages, just cookies so all I need to do is have 2 versions of the same database, on each virtual server (I assume) and 2 versions of the binaries/webpages on each server (I assume). What I need is some sort of guide to set these up so that when a user makes a request:

a) The servers are load balanced and the request sent to the least loaded server b) Whenever a SQL database change is made, it is reflected in the other database too

Does this sound possible?

share|improve this question

To answer your question yes it not only sounds possible but IS possible.

First, i'm guessing by the phrase you purchased 2 Virtual Servers that these are from some hosting company? OK lets assume thats true, you would honestly be better off using one as the database server and one as the web server if you are limited to just the two. If you think you will be having enough traffic to require two web servers then get a third server and run that as your database server. If you do get two web servers, yes you want your code on both servers.

If you really want two web servers and two database servers and only purchase two servers you can NOT run them in active active mode on the same database. Updates can only be sent to one master and then replication can propagate those changes to slaves.

Simple way to load balance is to do round-robin DNS, this is simple, quick, and not very hard to setup and does an OK job at spreading the load. Based on your question I'm making assumptions of your skill level recommending this as a starting point.

This really only scratches the surface and if your serious about this website and honestly believe it will have enough traffic to require a load balanced configuration please find someone who knows the systems side of things to help you.

share|improve this answer

What you describe there, from a database point of view, is a "master-master" replication scheme (see here for some notes on that which would probably means you need SQL Enterprise Edition (one license for each server) which isn't cheap - you will not be able to do this with Express Edition and probably not with Standard either. You could try implement this in your app logic, but this would be a complex can of worms. If the two servers are on the same vlan in the DC then you could have both servers access the same master DB in requests when they need to write anything but then read from their individual DBs for read-only requests - this can be dine with master-slave replication which is an easier (and potentially cheaper) prospect. Essentially: farming a SQL database to many machines is much harder than farming the web servers that access the database.

The easiest way to pass requests to two different web servers (if, as in the situation describe where all the HTTP(S) requests are carry all the state they need rather than some being held in a server-side "session", you don't need anything like "sticky sessions") is to use round-robin DNS by having multiple A records for the relevant name. See here. This does not account for one of the servers being down though so is not a solution for high availability and you have little control over the balance (you can't decide which machine gets the hits so you can reduce the hits on one server when it is already busy). For HA and controlled balancing, you need an extra machine that all the requests go through and have it decide which real web server gets the hit.

Scaling your application over multiple servers (for performance, high availability, geographical locality, or some combination of the above) is not as simple a task as it might first seem.

share|improve this answer

Why do you need 2 copies of the database? What kind of application are you hosting? is near real-time synchronization for the databases good enough?

why not point two web servers to a single database server? scaling-out sql server in the way you've described is not something to be taken lightly & this definitely won't be considered a quick & simple setup!

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.