tsenart / vegeta

HTTP load testing tool and library. It's over 9000!
http://godoc.org/github.com/tsenart/vegeta/lib
MIT License
23.51k stars 1.36k forks source link

How to do multiple (chain) request? #349

Closed theikalman closed 6 years ago

theikalman commented 6 years ago

Question

So I need to do multiple request (chaining) in one scenario. For example, I need to log-in the user and then get list of items and then buy the items. What is the best way to do that in vegeta? Currently I'm using this template to do that:

userLoginTargeter := ...........................
rate := vegeta.Rate{Freq: 1, Per: time.Second}
for response := range attacker.Attack(userLoginTargeter, rate, time.Second, "User Login")
   var token token.Response
   json.Unmarshal(response.Body, &tokenResponse)

   itemListTargeter := ..................
   resItemList := <-attacker.Attack(itemListTargeter, vegeta.Rate{Freq: 1, Per: time.Millisecond}, time.Millisecond, "Get Item List")
   var items []item.Response
   json.Unmarshal(resItemList.Body, &items)

   createOrderTargeter := ..................
   resCreateOrder := <-attacker.Attack(createOrderTargeter, vegeta.Rate{Freq: 1, Per: time.Millisecond}, time.Millisecond, "Create Order")

   results.Add(resCreateOrder)
}
tsenart commented 6 years ago

Vegeta wasn't designed with user sessions in mind, so this is not easy to do. I suppose what you're trying could work, but have you considered load testing one endpoint at a time, separately?

theikalman commented 6 years ago

I see. I have done it, doing load test per-endpoint. I just want to try to simulate what user do in real world scenario with vegeta if possible, so I can replace Gatling with vegeta completely since Gatling needs a lot of memory to run. Thanks @tsenart

tsenart commented 6 years ago

Try https://k6.io/

theikalman commented 6 years ago

Looks really cool. Going to try it :+1:

thinkerou commented 4 years ago

interesting...

thinkerou commented 4 years ago

I see. I have done it, doing load test per-endpoint. I just want to try to simulate what user do in real world scenario with vegeta if possible, so I can replace Gatling with vegeta completely since Gatling needs a lot of memory to run. Thanks @tsenart

@ajiyakin still use Gatling? thanks! I want to solve the issue.

fai555 commented 3 years ago

@theikalman Which tools would you recommend? Is vegeta good for simulating complex transactions?