vegeta icon indicating copy to clipboard operation
vegeta copied to clipboard

Load Test an API Endpoint with a Different Request Body Each Iteration

Open jon-whit opened this issue 5 years ago • 1 comments

I'd like to execute a load test again a specific API endpoint POST my.api.com/graphql. This API endpoint takes a request body that looks like this:

{
    "clientMutationId": (string)
    "messageId": (string)
    ...
}

Each iteration that each concurrent worker executes I'd like the request body to have a new messageId field. What would be the best way to achieve that dynamic target? I haven't seen any examples of this in any of the doc and I'm having a hard time figuring out what might be the best approach for that.

jon-whit avatar Aug 05 '20 14:08 jon-whit

Is this related to your question? : https://github.com/tsenart/vegeta/issues/330

cioboteacristian avatar Aug 19 '20 19:08 cioboteacristian

As long as that message id doesn't depend on a response from a previous request, then you can write a program or script that produces targets with those bodies (each with a different message ID) and feed it to vegeta attack with the -lazy flag on. I suggest you use the json target format.

tsenart avatar Jul 18 '23 21:07 tsenart