Load Balancing

There are a number of possibilities for load balancing. AFP can work with either an upstream router, a Round Robin DNS server or with Microsoft Network Load Balancing. If the distribution is made on the basis of the client IP or of DNS entries, no adjustments to the .afp documents will be required. If the router is designed specifically for the distribution of HTTP requests and differentiates on the basis of the server ID, the AFP documents have to be adjusted such that the router ID is used in lieu of the session ID assigned by the AFP.

IF Session.IsNew()

      Session.NewSession( Request.QueryString("RouterID") )

ENDIF

The preceding code assumes that the router attaches all requests to a query string and that the ID allocated by the router is included in the variable RouterID. If no session ID allocated by AFP is found, the AFP will automatically create a new session. At this point, this state is ascertained, the newly created session is abandoned and a new session is set up, this time only with the ID demanded by the router. In principle, AFP can accommodate all session IDs that do not exceed 80 characters.

For Microsoft NLB no additional hardware is required. All nodes in the cluster are assigned a node-specific and a cluster-specific IP address. All requests to be distributed have to be sent to the cluster-specific IP address which is identical for all nodes of the cluster. Microsoft NLB is a network driver that examines all requests directed to that virtual IP. A special algorithm determines from the client IP address, the port and other IP package data whether or not the machine is responsible for the IP package concerned. This computation is made simultaneously on all nodes of the cluster but a positive result will be returned for only one machine.  That machine then forwards the IP package to the TCP protocol stack while all the other machines discard the package.