Assign IP addresses to Vusers

When running DevWeb tests, you can use the multiple IP addresses (Multi IP) feature to simulate multiple virtual users with different IP addresses, originating from a single load generator.

You can also use the DevWeb APIs to obtain a list of IPs or the IP for the current Vuser, and allocate a specific IP to a Vuser.

About Multi IP

Application servers and network devices use IP addresses to identify clients, and try to cache client information to optimize throughput. Since Vusers on the same load generator have the same IP address, the optimizations do not reflect real-life situations.

The Multi IP feature enables Vusers running on a single load generator to be identified by many IP addresses. By simulating Vusers from multiple IP addresses, you can generate real-time requests in web applications, and achieve a more realistic and robust testing environment.

Before implementing the Multi IP feature, you configure multiple IP addresses on the load generator or the machine used for script replay. The IP addresses can be manually configured, or, for Windows installations, generated using the LoadRunner IP Wizard. For details, see Add IP addresses to a load generator in the LoadRunner Professional Help Center.

Back to top

Configuring replay with Multi IP

Multi IP can be configured in the rts.yml file, or from the command line.

For general information on how to configure the runtime settings in rts.yml, see Customize runtime settings.

Note: When assigning IP addresses manually using the API, no additional Multi IP configuration is required. For details, see API functions for IP addresses.

To configure Multi IP in rts.yml:

  1. In the rts.yml file for the script, expand the replay section.

  2. In the multiIP key, define a value to determine how the IPs are allocated to Vusers:

    Value Description
    none Disables automatic IP distribution (default value).
    roundrobin The round-robin algorithm assigns the IP addresses on a cyclical basis. Each Vuser receives a sequential IP address from the available pool.
    random

    This algorithm assigns the IP addresses randomly. Each Vuser receives an IP address from the available pool, without any specific order.

  3. Save your changes.

To configure Multi IP via the command line:

In a terminal window, configure Multi IP using the -multiIP\" flag followed by the selected value, such as roundrobin or random.

For example:

Devweb.exe -mode=load -multiIP=roundrobin c:\scripts\myscript

Back to top

API functions for IP addresses

The DevWeb JavaScript SDK includes API functions to give you more control over IP address management in your scripts:

getIPList

This function returns an array of IP addresses in the local machine. Each IP is presented as a string.

In your script, you can assign the result of this function to a variable, for example, IPList, to obtain a list of available IP addresses.

setIP

With this function, you can control the IP assignment process, by setting a specific IP address for the current Vuser.

After obtaining the IPList array with the getIPList function (above), you can select a random IP address from the list and assign it to the Vuser in the script.

If you are also using one of the Multi IP algorithms with your script, the defined IP for setIP will override the automatic selection.

getIP Use this function to obtain the IP address for the current Vuser.

For details on the APIs, see the Net section in the JavaScript SDK.

Back to top

See also: