Ask your Voice Assistant

Alexa, tell VoxSnap to play posts from BlazeMeter

Using IP Spoofing to Simulate Requests from Different IP Addresses with JMeter

It’s not easy today to find a single node system as both failover and resilience are key points of modern applications. So if you need to load test a system, it will likely be something clustered.

The idea of a cluster is to protect the application from failure. If one node goes out of order, the remaining ones will continue to serve incoming requests. Usually hardware or software load balancers act as a single entry point, orchestrating all the incoming requests and sending them to the appropriate backend servers.

The Challenge of Stickiness
One of the main features of load balancers is “stickiness” or “persistence” - a mechanism of wiring a client to one backend node behind the load balancer so requests could go back and forth. For example, if the application uses cookie-based authentication and the user has logged into one of the backend nodes, he will be authenticated there only for the amount of time required to replicate the session cache (which may be not immediate). This is one reason for stickiness.

Imagine a system architecture with a load balancer and 2 servers: server A and server B. As simulated by JMeter the request goes via the Load Balancer, hits Server A and gets a Cookie. If the following request will go to Server B, it will not be authenticated as for the moment only Server A knows about this user and accepts its Cookie, unless local caches are replicated into a Shared Cache.

A similar situation will happen if a protocol other than HTTP is being used. If communication is being conducted via FTP, it is vital that the requests are going back and forth between JMeter and Server A within the bounds of one session.

Simulating Requests from Different IP Addresses into a JMeter Test
Assuming all of the above is happening, you can run into a situation when all of the requests sent from JMeter are hitting only Server A, and Server B doesn’t receive any load. As a result, you cannot tell for sure whether or not your application is scaling correctly and the results of the load testing are vague. So let’s look at how to simulate requests originating from different IP addresses in your JMeter test.

If you look at the bottom of HTTP Request Sampler (you may have to scroll down) you’ll see the “Source Address” input.

You can use this input for IP Spoofing and put the IP address, hostname or network interface name so that JMeter will send the request from the specified source. Drop-down choices are:
● IP/Hostname
● Device
● Device IPv4
● Device IPv6

Usually load generator machines don’t have more than one network interface so I’ll focus on the …

See the rest at blazemeter.com