Load balancing is a technique to spread work between multiple back-end servers in order to obtain optimal resource utilization, throughput and response times. Requests are directed to the load balancing hardware or software and then forwarded to the appropriate server.
Load Balancing by IP Address
A variety of algorithms are used by load balancers to determine which back-end server to send a request to. One such method is load balancing by IP address. With this method requests are balanced across the back-end servers by the IP address of the machine from which the request originates.
An injector machine will typically have a single IP address and so all virtual users (VUs) generated from the injector will posses this same IP address. This will cause the load balancer to forward all requests from the injector to the same back-end server.
There are two strategies that can be employed to overcome this problem.
Strategy 1: Multiple Injectors
One way of running a performance test against a system under test that utilizes IP load balancing is to use multiple load injectors. If load balancing occurs across four back-end servers then the solution is to match this with four injectors; resulting in four source IP addresses. This will ensure that the load is distributed amongst all four back-end servers. All requests from each injector will be directed to one of the servers.
Strategy 2: IP Spoofing
If enough injectors cannot be sourced in order to pursue Strategy 1 then it may be appropriate to spoof the IP addresses of the VUs within the test. IP spoofing is a method of assigning an IP address to an individual VU.
For IP spoofing:
- You will need a range of unused IP addresses from your network administrator. These are the IP addresses that will be assigned to the VUs. Again, if there are four back-end servers participating in load balancing, the minimum number of IP addresses required for the virtual user population is also four.
- The network routing must also be capable of handling a PC with multiple IP addresses. Typically, the environment should be capable of working with static, rather than dynamic, IP addresses. The network administrator should be able to advise you on this.
To configure a Windows Injector for multiple local IP addresses, do the following:
Open Network Connections.
Right-click the required network connection and select Properties.
Under the General tab select Internet Protocol (TCP/IP) and then Properties.
Select Use the following IP address.
Now assign the IP addresses to your network card under the IP Settings tab.
You must also set the address of the DNS server on your network under the DNS tab.
The Microsoft WinHTTP and WinInet libraries do not support setting of local IP addresses, so
setLocalIPAddress() only has an effect when the Internal (Default) HTTP/HTTPS connection handler is used or the protocol is IP.
To restore the Windows machine to DHCP simply check the radio button Obtain an IP address automatically on the TCP/IP properties tab.