This patch fix an I/O throttling behavior triggered by limiting at 150 iops and running a load of 50 threads doing random pwrites on a raw virtio device.
After a few moments the iops count start to oscillate steadily between 0 and a value upper than the limit. As the load keep running the period and the amplitude of the oscillation increase until io bursts reaching the physical storage max iops count are done. These bursts are followed by guest io starvation. As the period of this oscillation cycle is increasing the cause must be a computation error leading to increase slowly the wait time. This patch make the wait time a bit smaller and tests confirm that it solves the oscillating behavior. Signed-off-by: Benoit Canet <ben...@irqsave.net> --- block.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block.c b/block.c index 0a062c9..455d8b0 100644 --- a/block.c +++ b/block.c @@ -3739,7 +3739,7 @@ static bool bdrv_exceed_iops_limits(BlockDriverState *bs, bool is_write, } /* Calc approx time to dispatch */ - wait_time = (ios_base + 1) / iops_limit; + wait_time = ios_base / iops_limit; if (wait_time > elapsed_time) { wait_time = wait_time - elapsed_time; } else { -- 1.7.10.4