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

Reference

blazemeter


Why need IP Spoofing

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.

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 the 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.



NOTE below is why we need ip spoofing:

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.


How

  • First of all we need to add a number of IP addresses on the operating system level.

    Using IP Spoofing to Simulate Requests from Different IP Addresses with JMeter_第1张图片
Using IP Spoofing to Simulate Requests from Different IP Addresses with JMeter_第2张图片
Using IP Spoofing to Simulate Requests from Different IP Addresses with JMeter_第3张图片
Using IP Spoofing to Simulate Requests from Different IP Addresses with JMeter_第4张图片
Using IP Spoofing to Simulate Requests from Different IP Addresses with JMeter_第5张图片
Using IP Spoofing to Simulate Requests from Different IP Addresses with JMeter_第6张图片
  • Start Tomcat
Using IP Spoofing to Simulate Requests from Different IP Addresses with JMeter_第7张图片
  • Configure JMeter
    IP.csv:
192.168.1.15
127.0.0.1


  
    
      
      false
      false
      
        
      
      
    
    
      
        continue
        
          false
          1
        
        2
        1
        1493827275000
        1493827275000
        false
        
        
      
      
        
          
            
          
          localhost
          8080
          
          
          
          
          
          GET
          true
          false
          true
          false
          false
          
          ${IP}
        
        
        
          false
          
            saveConfig
            
              
              true
              true
              true
              
              true
              true
              true
              true
              false
              true
              true
              false
              false
              true
              true
              false
              false
              false
              true
              0
              true
              true
              true
              true
              true
            
          
          
        
        
        
          ,
          
          IP.csv
          false
          true
          shareMode.all
          false
          IP
        
        
      
    
  



  • Result

日志路径为:/apache-tomcat-8.5.14/logs/localhost_access_log.xxx.txt

Using IP Spoofing to Simulate Requests from Different IP Addresses with JMeter_第8张图片

你可能感兴趣的:(Using IP Spoofing to Simulate Requests from Different IP Addresses with JMeter)