block: fix bdrv_exceed_iops_limits wait computation

Submitted by Benoît Canet on March 20, 2013, 9:12 a.m.

Details

Message ID 1363770734-30970-2-git-send-email-benoit@irqsave.net
State New
Headers show

Commit Message

Benoît Canet March 20, 2013, 9:12 a.m.
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 <benoit@irqsave.net>
---
 block.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Zhi Yong Wu March 20, 2013, 10:55 a.m.
Reviewed-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>

On Wed, 2013-03-20 at 10:12 +0100, Benoît Canet wrote:
> 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 <benoit@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 {

Patch hide | download patch | download mbox

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 {