tsenart / vegeta

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

Limiting total number of requests #684

Closed rsiatka closed 2 months ago

rsiatka commented 7 months ago

Question

Hi, I can see that for vegeta the main condition to stop the simulation is time (-duration param). But is there an option to stop the simulation after reaching a certain number of sent requests? For example, tools such as: ab, oha, hey in addition to duration, have a parameter -n that is limiting number of requests to run - when this value is reached the simulation ends.

noboruma commented 6 months ago

@rsiatka what about the -rate option? You can limit like: -rate=100/s and do -duration=10s which should give you 1000 requests in total

rsiatka commented 6 months ago

Thank you @noboruma. The solution with rate limit definitely helps. In my test scenario i'm trying to test application using closed workload model - sending 1M requests in shortest possible time using 1 connection only. I was hoping there is an option to detect max possible throughput automatically for such scenario but of course i can establish the value repeating the test several times for a different duration and rate. Thanks a lot.

noboruma commented 6 months ago

You're welcome @rsiatka You can only assess after trying what was the highest rate achievable. There are many factors that will impact your network connectivity (your NIC, the state of the network, the distance, and so on). So even if you ask for 1M RPS, the tool might not be able to provide you the requested rate depending on physical constraints.

To limit the unknowns, try to test on a private network and always record how many requests were successful.

rsiatka commented 6 months ago

Yes @noboruma, totally agree. In order to simplify the tests and reduce the factors causing uncertainty, I have disabled the NIC and testing my service on localhost first, actually on 127.0.0.1 because vegeta, in the absence of a card, cannot resolve localhost on winows. Getting Get http://localhost:999: lookup localhost on [::1]:53: read udp [::1]:50813->[::1]:53: i/o timeout