Microsoft

Replication and clustering improve reliability and performance in IIS

If your Web site gets too many hits at once, everything slows down. Scott Lowe shows you how to set up replication and clustering in IIS to improve your site's reliability and performance.


High-availability Web services are essential if you want your Web site to continue operations for any length of time or serve a high volume of clients. A single server running Microsoft Internet Information Services 5.0 is at risk of failure or of being overwhelmed by requests. In this Daily Drill Down, I’ll show you how to set up clustering and replication in IIS. Replication will ensure that your site continues to operate in the event of a failure, and clustering will give it the additional horsepower it needs to serve a larger number of clients.

Replication prerequisites
Clustering will not work with Windows 2000 Server. Instead, you must use Windows 2000 Advanced Server or Windows 2000 Datacenter Server. I’ll focus on the Advanced Server edition.

Windows 2000 Advanced Server has two different services to help you create a fault-tolerant site. The first is the Cluster service, and the second is Network Load Balancing (NLB).

Microsoft doesn't recommend using the Cluster service to create Web sites since it doesn't scale very well. In addition, Windows 2000 Advanced Server supports only two-node clusters, while the Data Center edition supports only four nodes. That's not enough for high-traffic Web sites that need the ability to scale.

Because of this recommendation, I'll focus on NLB, which supports up to 32 nodes.

Author’s assumption
For the purposes of this Daily Drill Down, I’ve assumed that you have IIS installed and running, and that you are able to get to content on both of the machines from a Web browser.
If you plan to follow our example, one of the two machines needs to be a domain controller in order to make the replication portion work properly. In your real environment, I don't recommend making a domain controller a Web server. Use a separate server instead.


The technology
You must do two things to make the Cluster service work properly. First, you need to set up load balancing. This will give you multiple servers from which to serve content to clients. Second, you must replicate the actual content among the various load-balanced servers so that clients receive consistent content, no matter which server they connect to.

There are many ways to handle both of these tasks, depending on your needs and your budget. For this Daily Drill Down, I'll use the components that are included with Windows 2000 Advanced Server and no other specific hardware or software. These two components are the NLB component for load balancing and the Windows 2000 Distributed File System (Dfs) component for replication.

Network Load Balancing
Of these two components, NLB is the only one that is required. In theory, you don't need replication since you could manually update the content as it changed, but that would be extremely inefficient, not to mention tedious and boring.

To enable NLB on your Windows 2000 Advanced Server machines, log on as a user with administrator rights and click Start | Settings | Control Panel | Network And Dial-Up Connections. From the list of connections, decide which interface you'll use to serve your Web clients. Next, right-click that interface and choose Properties. When the Properties dialog box appears, select Network Load Balancing. Click OK to close the box.

Now, go back into the properties of the interface you chose and double-click on the NLB component to bring up its properties dialog box. You’ll see a screen similar to that in Figure A.

Figure A
Network Load Balancing Properties—Cluster Parameters tab


The settings you can make on this page are:
  • Primary IP Address/Subnet Mask—This is the IP address/mask that you'll use for the cluster. It should be different from the IP address of the local machine. This is the same address that will be used to address all the machines in the cluster.
  • Full Internet Name—The full Internet name is generally the name by which the server cluster will be addressed. Again, this should not be the same name as any of the machines participating in the cluster.
  • Network Address—Every IP address needs to map back to something physical on the machine—generally a Media Access Control (MAC) address. This address is unique to every network adapter, but since this is a cluster, it needs to use an address that is different from the physical network adapter running the cluster. Windows 2000 Advanced Server automatically derives this value.

The other settings, Multicast Support, Remote Password, Confirm Password, and Remote Control, are worth mentioning, though they are beyond the scope of this Daily Drill Down:
  • Multicast Support—If you want to use multicast, you can enable it here.
  • Remote Password/Confirm Password/Remote Control—If you want to allow remote control of a cluster, it's highly advisable to set a password as a line of defense against would-be intruders.

The next step in configuring your server to support NLB is to click the Host Parameters tab of the Network Load Balancing Properties dialog box, as shown in Figure B. Enter the information that tells the server how to behave as part of the cluster.

Figure B
Host Parameters tab


The Host Parameters settings are:
  • Priority (Unique Host ID)—This number is required on each balanced node and must be unique—hence “unique” host ID. The cluster uses the host ID to determine which node will handle traffic in the event that a node fails. The lower the number, the higher the priority. When a node fails, tasks for it are instead directed to the node with the next lowest host ID.
  • Initial Cluster State—This specifies whether the node should join the cluster immediately upon boot. If you decide not to have a host immediately join a cluster, you can manually join it using the NLB command-line tools.
  • Dedicated IP Address/Subnet Mask—Traffic not bound for the cluster needs to be answered by something. This is the IP address of the network adapter for noncluster traffic.

Figure C shows the last tab, Port Rules. It specifies the ways in which the cluster can handle various network traffic. You can use this tab to tune your cluster's performance on your network. It's difficult to make hard-and-fast recommendations here because much of it depends on your network configuration and your Web site’s intended use.

Figure C
Port Rules tab


For my example, I'll use the following parameters:
  • Cluster IP address/subnet mask: 172.16.1.240/255.255.255.0
  • Cluster name: cluster.somename.com
  • Priority: 1 for WAS1 (first clustered node)
    2 for WAS2 (second clustered node)
  • Initial cluster state: Active
  • Dedicated IP address/subnet mask:
    WAS1 - 172.16.1.82/255.255.255.0
    WAS2 - 172.16.1.88/255.255.255.0
  • Port rules: I’ll use all of the defaults here.

I don’t recommend using DHCP addresses for anything on a clustered server. In fact, you need to enter the IP address of the machine in the TCP/IP properties (the same as the Dedicated Address in NLB). In addition, you must enter the cluster's IP address in the Advanced TCP/IP properties dialog box (accessed by clicking Advanced on the TCP/IP properties screen). In a perfect world, NLB would do this for you, but it doesn’t.

When you’ve finished, you should be able to browse to the cluster IP address and get content.

Next up: Replication
Once the load balancing system is in place, you have a cluster of devices that can all respond to requests via a single IP address. Next on your to-do list is to set up a system to replicate content between the servers so that you don’t have to manually copy files around your network. While this might not be too difficult in a two-node system, the work becomes a little harder with dozens of nodes. For this task, I'll use Windows 2000’s Dfs.

The components that make Dfs work are installed when you install Windows 2000. To start using Dfs, browse to Start | Programs | Administrative Tools | Distributed File System. This will open the Distributed File System management console, which is where the bulk of the work in this section will take place.

If you haven't used Dfs on your servers before, you'll need to add a new Dfs root. A Dfs root is similar to a share in that it's accessible over the network, but it provides fault tolerance because the data can reside on multiple servers.

To add a new Dfs root, right-click Distributed File System and choose New Dfs Root from the shortcut list. This will start a wizard. On the Select The New Dfs Root Type screen, choose Create A Domain Dfs Root. These types of Dfs roots can be automatically replicated, providing fault tolerance. You can also use them with NLB to implement a high-availability system.

In the next step, the wizard will ask for the domain that will host this Dfs root. In this example, I'm using a domain named myarticle.com. Every Dfs root needs a host server. For this particular Dfs root, I'll use as1.myarticle.com as the host server. As1.myarticle.com and as2.myarticle.com are the two load-balanced servers I set up in the previous section.

As with any share, you need to decide what directory will be used for the Dfs root. Since I'm planning to replicate Web content using Dfs, I'll use C:\Inetpub\Wwwroot as the Dfs root, with a name of wwwroot. Figure D shows the final screen of this example, with all the choices I made when using the wizard.

Figure D
Dfs root creation choices


Once you've created the Dfs root, you need to create a replica of the root to make the Dfs root fault tolerant and to replicate it to other servers.

To create a replica, right-click the Dfs root you created and choose New Root Replica from the shortcut menu. In the server name box, either type the name of the second server or browse for it on the network. In my case, the server name is as2.myarticle.com. When asked for the share point, create a share identical to the one on your first server. When you're done, you'll see a screen similar to the one in Figure E.

Figure E
The final showing for the Dfs root and its replica


With replication in place, you need to set a policy on how the actual process takes place. To set a policy, right-click the Dfs root entry on the master server and choose Replication Policy from the list. The Replication Policy screen shown in Figure F will appear.

Figure F
Replication Policy dialog box


You'll initially place new content on the master server. Click on the master server and then click the Set Master button to tell Dfs that this server will initiate the replication process. For the secondary server, click on its name and choose the Enable button to enable it to replicate content from the master. Click OK when you’re done.

You've now enabled automatic replication, and it will happen every 15 minutes. As a test for this process, I created a small test document in C:\Inetpub\Wwwroot on as1, my master server. After a reasonable replication period, the file showed up in the identical location on as2, my secondary server, and I was able to view it!

Get it together
Clustering and replication are extremely important in today’s fast-paced, high-availability business environments. Using tools already available in Windows 2000 Advanced Server, you can easily create these types of environments for yourself. You can use NLB to create a cluster of up to 32 machines. And Dfs makes content synchronization extremely painless and very efficient.

 

Editor's Picks

Free Newsletters, In your Inbox