I'm using WLBS in Windows 2000 for 2 web servers for redundancy and load balancing. When I want to take one of the services down, I use "WLBS drainstop" from the command line. However from monitoring the number of open connections in IIS, it takes quite a while for the existing connections to be closed. If I run "WLBS stop" the remaining connections will hang for a couple minutes while they figure out the other end of the connection is no longer there. We don't have any need for long running connections, and page requests are returned in well under 10 seconds. Is there some way for WLBS, or IIS to close any open, non-active connections, so that I can remove a server from load balancing without waiting for all the open connections to close by themselves?
Using an old trick from the Joel discussion groups of turning off keep-alive, and then running WLBS drainstop was the key to getting this to work properly. Then I wrote a script in VBS to automate the whole thing. There's 2 scripts. One script to remove the node from the cluster, and another to bring the node back online.
The Remove Script is as follows.
And the script for bringing the machine back online is as follows.
You can change the IISInstanceName variable at the top of the script to match the name of your web server. This is the name that shows up when you go to the "Internet Information Services" section under "Administrative Tools". You can change this to whatever you have named your web server. Overall it's a little clunky, but it works. It's Also Possible to change the first Line To
and then cut out the whole for loop that looks for the server by name, but I think it's a little more "correct" to find the server by name, rather than by some number, which I'm not sure if windows would change under some circumstances of adding and removing web server instances.
Just lowering the keepalive timeout from two minutes down to ~20 seconds might be enough.