locustio / locust

Write scalable load tests in plain Python 🚗💨
MIT License
24.64k stars 2.96k forks source link

stats reset after hatch completes #91

Closed bretrouse closed 11 years ago

bretrouse commented 11 years ago

Why is LocustRunner resetting stats when hatching is complete? What if you want to capture stats at the end of a hatch? I don't understand.

    # register listener that resets stats when hatching is complete
    def on_hatch_complete(count):
        self.state = STATE_RUNNING
        logger.info("Resetting stats\n")
        self.stats.reset_all()
    events.hatch_complete += on_hatch_complete
cgbystrom commented 11 years ago

To get to the running state as fast as possible, you need to ramp up your Locusts (users) quickly. This often results in an unnatural behaviour that usually put a lot of stress on your servers. The stress can result in possibly higher response times and error rates. To prevent this, Locust reset the stats to prevent those ramp up stats coloring the running stats.

bretrouse commented 11 years ago

Ah, got it. Thanks!

spearsem commented 6 years ago

@cgbystrom Can this be re-opened? The explanation given in https://github.com/locustio/locust/issues/91#issuecomment-23130917 only applies to one type of use case, but there are others.

For example, consider a load test in which you choose a fractional hatch-rate, like adding 1 new user every 30 seconds, or every minute. You might be load testing on a small scale to establish graphs that show you how your service latency saturates with a single server as you steadily increase the number of users.

In a case like that, you don't want to ramp up to the max users quickly, rather slowly. And the data collected about how the service slowly saturates is the important data. The data at the far tail where you are saturated with users is not that relevant on its own.

heyman commented 6 years ago

@spearsem Locust has had a flag for not resetting the stats for a long time, and since #674 has been merged, it’s now the default behaviour. So you should be good :).