Skip to contentSkip to conversation

qemu-options: explain disk I/O throttling options

PATCH Superseded Stefan Hajnoczi 4 participants 6 messages Feb 20, 2017 – Feb 22, 2017

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 qemu-options: explain disk I/O throttling options

The disk I/O throttling options have been listed for a long time but never explained on the QEMU man page.

---
 qemu-options.hx | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
qemu-options.hx +25 -0
index 5633d39..b2254cc 100644
@@ -587,6 +587,31 @@ file sectors into the image file.
 conversion of plain zero writes by the OS to driver specific optimized
 zero write commands. You may even choose "unmap" if @var{discard} is set
 to "unmap" to allow a zero write to be converted to an UNMAP operation.
+@item bps=@var{b},bps_rd=@var{r},bps_wr=@var{w}
+Specify bandwidth throttling limits in bytes per second, either for all request
+types or for reads or writes only.  Values must be larger than the maximum
+request size to avoid timeouts or hangs in the guest.  At minimum use 2 MB/s
+for disks.
+@item bps_max=@var{bm},bps_rd_max=@var{rm},bps_wr_max=@var{wm}
+Specify bursts in bytes per second, either for all request types or for reads
+or writes only.  Bursts allow the guest I/O to spike above the limit
+temporarily.  The default burst value is 1/10th of the limit.
+@item iops=@var{i},iops_rd=@var{r},iops_wr=@var{w}
+Specify request rate limits in requests per second, either for all request
+types or for reads or writes only.
+@item bps_max=@var{bm},bps_rd_max=@var{rm},bps_wr_max=@var{wm}
+Specify bursts in requests per second, either for all request types or for reads
+or writes only.  Bursts allow the guest I/O to spike above the limit
+temporarily.  The default burst value is 1/10th of the limit.
+@item iops_size=@var{is}
+Let every @var{is} bytes of a request count as a new request for iops
+throttling purposes.  Use this option to prevent guests from circumventing iops
+limits by sending fewer but larger requests.
+@item group=@var{g}
+Join a throttling quota group with given name @var{g}.  All drives that are
+members of the same group are accounted for together.  Use this option to
+prevent guests from circumventing throttling limits by using many small disks
+instead of a single larger disk.
 @end table
 
 By default, the @option{cache=writeback} mode is used. It will report data
Signature · 1 line
2.9.3
Reviewed-by on v1 1/1
#1 lore raw
Quoted 15 lines · Stefan Hajnoczi

The disk I/O throttling options have been listed for a long time but never explained on the QEMU man page.

---
 qemu-options.hx | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
qemu-options.hx +0 -0
index 5633d39..b2254cc 100644

qemu-options.hx file sectors into the image file. · line 593

Quoted 7 lines
qemu-options.hx +4 -0
@@ -587,6 +587,31 @@ file sectors into the image file.
 conversion of plain zero writes by the OS to driver specific optimized
 zero write commands. You may even choose "unmap" if @var{discard} is set
 to "unmap" to allow a zero write to be converted to an UNMAP operation.
+@item bps=@var{b},bps_rd=@var{r},bps_wr=@var{w}
+Specify bandwidth throttling limits in bytes per second, either for all request
+types or for reads or writes only.  Values must be larger than the maximum
+request size to avoid timeouts or hangs in the guest.  At minimum use 2 MB/s

s/At minimum/At a minimum,/

With that tweak,

Signature · 2 lines
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org
#2 lore raw
Quoted 26 lines · Eric Blake
Quoted 15 lines · Stefan Hajnoczi

The disk I/O throttling options have been listed for a long time but never explained on the QEMU man page.

---
 qemu-options.hx | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
qemu-options.hx +0 -0
index 5633d39..b2254cc 100644

qemu-options.hx file sectors into the image file. · line 593

Quoted 7 lines
qemu-options.hx +4 -0
@@ -587,6 +587,31 @@ file sectors into the image file.
 conversion of plain zero writes by the OS to driver specific optimized
 zero write commands. You may even choose "unmap" if @var{discard} is set
 to "unmap" to allow a zero write to be converted to an UNMAP operation.
+@item bps=@var{b},bps_rd=@var{r},bps_wr=@var{w}
+Specify bandwidth throttling limits in bytes per second, either for all request
+types or for reads or writes only.  Values must be larger than the maximum
+request size to avoid timeouts or hangs in the guest.  At minimum use 2 MB/s

s/At minimum/At a minimum,/

Quoted 2 lines

With that tweak,

Will fix when merging.

Stefan

#3 lore raw
In reply to Stefan Hajnoczi

qemu-options.hx file sectors into the image file. · line 601

Quoted 6 lines · Stefan Hajnoczi

The disk I/O throttling options have been listed for a long time but never explained on the QEMU man page.

+@item bps=@var{b},bps_rd=@var{r},bps_wr=@var{w}

qemu-options.hx +2 -0
+Specify bandwidth throttling limits in bytes per second, either for all request
+types or for reads or writes only.

Perhaps for the manual page it makes sense to use them, but bps, bps_rd, etc. are the legacy names for those options. They're internally renamed to throttling.bps-total, throttling.bps-read, ...

qemu-options.hx file sectors into the image file. · line 594

Quoted 3 lines

Values must be larger than the maximum

qemu-options.hx +2 -0
+request size to avoid timeouts or hangs in the guest.  At minimum use 2 MB/s
+for disks.

Is this so? throttle_compute_wait() does not use the request size at all. The size is used to do the accounting afterwards. In other words:
requests are not throttled if they exceed the limit, they are throttled after the limit has been exceeded by previous requests.

A low limit will certainly slow down the guest and can cause timeouts, but I don't know if being larger or smaller than the maximum request size is what makes the difference.

qemu-options.hx file sectors into the image file. · line 598

Quoted 4 lines

+@item bps_max=@var{bm},bps_rd_max=@var{rm},bps_wr_max=@var{wm}

qemu-options.hx +3 -0
+Specify bursts in bytes per second, either for all request types or for reads
+or writes only.  Bursts allow the guest I/O to spike above the limit
+temporarily.  The default burst value is 1/10th of the limit.

"The default burst value is 1/10th of the limit" is an implementation detail that the user doesn't need to know about. What it means is that a bps limit of 10 MB/s is implemented internally as 1MB per 100ms.

I would leave that out, it doesn't even make sense that the burst limit is lower than the normal limit, we actually forbid that (aaa1e77ffae52).

qemu-options.hx file sectors into the image file.

Quoted 5 lines

+@item iops=@var{i},iops_rd=@var{r},iops_wr=@var{w}

qemu-options.hx +3 -0
+Specify request rate limits in requests per second, either for all request
+types or for reads or writes only.
 
+@item bps_max=@var{bm},bps_rd_max=@var{rm},bps_wr_max=@var{wm}

You meant iops_max, iops_rd_max and iops_wr_max here?

Berto

#4 lore raw
Quoted 11 lines · Alberto Garcia

qemu-options.hx file sectors into the image file. · line 601

Quoted 6 lines · Stefan Hajnoczi

The disk I/O throttling options have been listed for a long time but never explained on the QEMU man page.

+@item bps=@var{b},bps_rd=@var{r},bps_wr=@var{w}

qemu-options.hx +2 -0
+Specify bandwidth throttling limits in bytes per second, either for all request
+types or for reads or writes only.

Perhaps for the manual page it makes sense to use them, but bps, bps_rd, etc. are the legacy names for those options. They're internally renamed to throttling.bps-total, throttling.bps-read, ...

I used the parameter names already listed in the -drive documentation. We need to keep the legacy names but I will add another patch that documents the new names and encourages using them.

Quoted 9 lines

qemu-options.hx file sectors into the image file. · line 594

Quoted 3 lines

Values must be larger than the maximum

qemu-options.hx +2 -0
+request size to avoid timeouts or hangs in the guest.  At minimum use 2 MB/s
+for disks.

Is this so? throttle_compute_wait() does not use the request size at all. The size is used to do the accounting afterwards. In other words:
requests are not throttled if they exceed the limit, they are throttled after the limit has been exceeded by previous requests.

Quoted 3 lines

A low limit will certainly slow down the guest and can cause timeouts, but I don't know if being larger or smaller than the maximum request size is what makes the difference.

You are right, I'm still have the behavior of the old throttling implementation in mind.

I'd still like to recommend a sane minimum because anything around the size of a single request leads to timeouts and hangs inside the guest.

How about:

Small values can lead to timeouts or hangs inside the guest. A safe minimum for disks is 2 MB/s.

Quoted 11 lines

qemu-options.hx file sectors into the image file. · line 598

Quoted 4 lines

+@item bps_max=@var{bm},bps_rd_max=@var{rm},bps_wr_max=@var{wm}

qemu-options.hx +3 -0
+Specify bursts in bytes per second, either for all request types or for reads
+or writes only.  Bursts allow the guest I/O to spike above the limit
+temporarily.  The default burst value is 1/10th of the limit.

"The default burst value is 1/10th of the limit" is an implementation detail that the user doesn't need to know about. What it means is that a bps limit of 10 MB/s is implemented internally as 1MB per 100ms.

I would leave that out, it doesn't even make sense that the burst limit is lower than the normal limit, we actually forbid that (aaa1e77ffae52).

Unfortunately the bps_max = avg / 10 default value is visible via query-block. A bug was recently reported about this:
https://bugzilla.redhat.com/show_bug.cgi?id=1414630

Would you prefer a private field in the throttling code so this detail is hidden from users?

Quoted 7 lines

qemu-options.hx file sectors into the image file.

Quoted 5 lines

+@item iops=@var{i},iops_rd=@var{r},iops_wr=@var{w}

qemu-options.hx +3 -0
+Specify request rate limits in requests per second, either for all request
+types or for reads or writes only.
 
+@item bps_max=@var{bm},bps_rd_max=@var{rm},bps_wr_max=@var{wm}

You meant iops_max, iops_rd_max and iops_wr_max here?

Yes, thanks! Will fix in v2.

Stefan

#5 lore raw
Quoted 13 lines · Stefan Hajnoczi
Quoted 9 lines

qemu-options.hx file sectors into the image file. · line 594

Quoted 3 lines

Values must be larger than the maximum

qemu-options.hx +2 -0
+request size to avoid timeouts or hangs in the guest.  At minimum use 2 MB/s
+for disks.

Is this so? throttle_compute_wait() does not use the request size at all. The size is used to do the accounting afterwards. In other
words: requests are not throttled if they exceed the limit, they are throttled after the limit has been exceeded by previous requests.

Quoted 3 lines

A low limit will certainly slow down the guest and can cause timeouts, but I don't know if being larger or smaller than the maximum request size is what makes the difference.

Quoted 5 lines

You are right, I'm still have the behavior of the old throttling implementation in mind.

I'd still like to recommend a sane minimum because anything around the size of a single request leads to timeouts and hangs inside the guest.

Yes, that sounds sensible.

Quoted 4 lines

How about:

Small values can lead to timeouts or hangs inside the guest. A safe minimum for disks is 2 MB/s.

Looks good to me.

Quoted 12 lines
Quoted 11 lines

qemu-options.hx file sectors into the image file. · line 598

Quoted 4 lines

+@item bps_max=@var{bm},bps_rd_max=@var{rm},bps_wr_max=@var{wm}

qemu-options.hx +3 -0
+Specify bursts in bytes per second, either for all request types or for reads
+or writes only.  Bursts allow the guest I/O to spike above the limit
+temporarily.  The default burst value is 1/10th of the limit.

"The default burst value is 1/10th of the limit" is an implementation detail that the user doesn't need to know about. What it means is that a bps limit of 10 MB/s is implemented internally as 1MB per 100ms.

I would leave that out, it doesn't even make sense that the burst limit is lower than the normal limit, we actually forbid that (aaa1e77ffae52).

Quoted 6 lines

Unfortunately the bps_max = avg / 10 default value is visible via query-block. A bug was recently reported about this:
https://bugzilla.redhat.com/show_bug.cgi?id=1414630

Would you prefer a private field in the throttling code so this detail is hidden from users?

Oh, I see. I would rather hide it from the user, either in throttle.c or even in bdrv_block_device_info().

Berto