Possible rate calculation issue
While creating some test run scenarios for f1 defining constant rates, I found out that the calculated rate does not entirely work as expected; This was primarily discovered while creating f1-jobs ran in our staging env. Still need confirmation if coding a simple scenario locally would yield the same result (will do this once I have some time and open an example PR)
Example cases:
- Constant rate of 1/300ms does not work at all
- Constant rate of 1/215ms results in precisely 5TPS, when it should yield approx. 4.65. Additionally, setting rate to 1/299ms results in the same 5 TPS.
Constant rate of 1/300ms does not work at all
This appear to be coming from rounding error. PR https://github.com/form3tech-oss/f1/pull/88 attempts to address it, by introducing float comparison tolerance.
Constant rate of 1/215ms results in precisely 5TPS, when it should yield approx. 4.65. Additionally, setting rate to 1/299ms results in the same 5 TPS.
This seems to be intended by design, based on the code. The "regular" distribution has a fixed resolution of 100 ms, and therefore iteration duration is rounded down to 100 ms. As a result 200ms, 215ms, and 299ms are essentially the same thing.
Fixed by #141