vernemq / vmq_mzbench

An MQTT loadtest and usage scenario tool for VerneMQ and other MQTT systems.
Apache License 2.0
42 stars 44 forks source link

Ensure time diff is always positive #4

Closed MainRo closed 8 years ago

MainRo commented 8 years ago

Add some checks to ensure that computing time differences is always positive. This fixes the following worker errors:

08:20:37.094 [error] <0.227.0> gen_fsm <0.227.0> in state connected terminated with reason: {value_out_of_range,-63} in mz_histogram:notify/2 line 73

ioolkos commented 8 years ago

Thank you, @MainRo! :)

@timofey-barmin: shouldn't MZBench do this by itself (ie. ensuring that mz_histogram:notify values are positive). Or rather: is there a specific reason for not doing it?

timofey-barmin commented 8 years ago

Hey @ioolkos,

As you can see mzbench throws {value_out_of_range,-63} in that case. I don't think we should always silently write 0 in histogram. mz_histogram is based on hdr_histogram hence only not negative values make sense (they are supposed to be latencies). If we get negative value we don't know what to do with it. In your case maybe it's ok to store 0 but in another case maybe you'll want to crash or increment some kind of "number of anomalies" counter for example. Only mzbench user knows how to handle it. Does it make sense?

ioolkos commented 8 years ago

@timofey-barmin @MainRo Yes, this makes perfect sense. Use cases are different & some "anomalies counter" might be useful for some. I'll merge the Set to 0 solution for now, so that we can collect experience on this.

Thanks a lot, Timofey and Romain, for your time & effort :+1: