Yandex-tank - several requests with different http headers

1.9k Views Asked by At

Have anyone tried to use Yandex-tank as http load testing tool?

I have a usecase to test a http service with multiple requests containing different path and query params and different http headear.

E.G. First request type - /test/user1?param1=1 [X-Forwarded-For: 192.168.0.1], second request type - /test/user2?param1=2 [X-Forwarded-For: 192.168.0.2]

And the problem is how to configure ammo.txt file to have different http headers.

I tried:

# load.conf    
[phantom]
address=myservice.loc #Target's address and port .
rps_schedule=line(1, 50, 1m) ## 1 minute, from 1 to 50 requests per second

# ammo.txt    
[X-Forwarded-For: 192.168.0.1]
/test/user1?param1=1    

[X-Forwarded-For: 192.168.0.2]
/test/user2?param1=2

Test performs ok but all the requestd have X-Forwarded-For: 192.168.0.1

I wounder how to configure ammo.txt to fit my usecase (to have different headers)? Also could you please suggest some alternative tool to do this?

1

There are 1 best solutions below

1
On

You can not have different headers when using URI format.

UPD: we added a new feature and now you can do that in uri-style ammo, see docs. An example of a uri-style ammo with headers modification:

[Connection: close]
[Host: target.example.com]
[Cookies: None]
/?drg tag1
/
/buy tag2
[Cookies: test]
/buy/?rt=0&station_to=7&station_from=9

You also could generate ammo in request-style as described here. An example of request-style ammo with different 'Host' headers:

34 good
GET / HTTP/1.0
Host: xxx.tanks1.example.com
User-Agent: xxx (shell 1)

78 bad
GET /abra HTTP/1.0
Host: xxx.tanks2.example.com
User-Agent: xxx (shell 1)

79 unknown
GET /ab/ra HTTP/1.0
Host: xxx.tanks3.example.com
User-Agent: xxx (shell 1)

34 good -- this is the header, the number is the size of the following request in bytes (including line endings). And good is a marker.