I have a WCF service deployed on IIS and using SQL Server 2008 as backend.
My question is: How can I make cluster(load-balance/fail-over) on IIS and on SQL Server and what sort of thing do I need to keep in mind before doing this? (e.g. do I have to move sessions from in memory to SQL server etc.)
Also, how can I make sure that both SQL servers have the mirror data all time and does both SQL servers shares locks (row, page, table) information in real time?
This is my first time on this. Is this called web farming?
I guess IIS and SQL are on separate servers:
IIS: You can use Microsoft NLB feature to spread the load between 2 or more servers. They can be Web editions of Windows. It's included in windows. You will have a virtual IP that client will connect to. Servers will "share" this ip and spread client to different server. The multicast/unicast depend on the network, number of nic and intra server communication or not. NLB is not application aware, if you shut IIS, users will be lost if you have affinity. NLB just remove a server if it's down from an ip point of view. You will have to change in IIS metabase (loadbalancercapabilities) as explained here: http://technet.microsoft.com/en-us/library/cc757659(WS.10).aspx From a license point of view, it's included in windows, no more cost.
From WCF point of view: Client will connect to one of the X web servers. You can maintain them on the same servers while this one is working (through affinity). Affinity is based on a hash between client IP and Virtual IP. If a server fail, client will be dispatched to others servers. If you use http sessions/authentication, you will have to store session outside of the server, like on the database. Else client session will be lost when a server fail.
SQL: You have differents options: using SQL mechanism to replicate database, or use Microsoft MSCS (cluster). The last one means Windows enterprise version and external shared storage which imply high cost (but still SQL standard version). Going with SQL pure layer, you can mirror your database. Each server got a local storage, and the primary send transaction on the fly to the standby server (synchrone or asynchrone). When your webserver connect, the server tell him that a standby server is available in case of problem, through the SQL native client and or ADO.Net. So your webserver switch to the standby server automatically in case of problem. This all works with standard SQL version. Databases need to be in full recovery mode. It's per database, so if your WCF use multiple database, and only one is broken, you will have issue because one database is now active on the standby server, but all others are still on the primary server.
More info here: http://technet.microsoft.com/en-us/library/cc917680.aspx
I got 6 server iis and i also got WCF service to.
I use ARR (Application Request Routing), is an IIS module extension, to route the request to my web farm. it's working very fine.
I also use NLB for my WCF service like Mathieu tell.
For my SQL server i use Hyper-V, two VM for my sql server, with a SQL cluster and windows faileover cluster and Live migration.
I will answer in french, so if some body can translate it's will be appreciate.
Ce que vous devez faire, c'est avoir un serveur de cluster. Ce serveur va servir à maintenir le "heart beat" entre vos deux serveur SQL. Les deux serveur SQL doivent être sur des machines distinct, mais doivent partager le même partage réseaux (SAN ou NAS ou autre). Les bases de donnée sont monté sur un seul serveur à la fois. Lorsque le "heart beat" est brisé, l'autre serveur prend la relève, et monte en une fraction de seconde les base de donnée et votre service est revenue, ceci est le "failover cluster". Lorsque le processus de transfert de serveur commence vous pouvez perdre quelques pings. Ce qui va détruire tous vos connection actuelle vers la base de donnée. La seul facons que vous pouvez être "UP" à 99 % c'est d'y ajouter live migration. Vous avez un 2 serveur Hyper-V (host) qui monte vos deux serveur SQL (un sur chaque host), vous activer le live migration entre vos deux machine virtuel, donc si vous avez à redémarer un host (serveur qui héberge SQL), vous faites un live migration de votre machine sql d'un host à l'autre. La mémoire sera transferer d'un coté à l'autre et vous n'aurez aucune perte de connection. Votre failover fonctionne toujours, donc si c'est la machine virtuelle qui détient le service sql qui plante, alors c'est l'autre qui va prendre la relève et vous perdrez alors quelques ping mais votre service sera remonté très rapidement.
J'epère que cela va vous aider, et désoler pour le francais, mais en anglais j'aurais surement été mal compris.
Yes, clustered web servers are normally called web farms (note that the term does not have any SQL databases associated with it, only web servers).
One would normally use a load balancer in front of the webservers.