[Qemu-discuss] What does "COW" mean?

2014-09-02 Thread shhuiw


Hi,

I'm new to qemu community, and I'm trying the COW image format (old but 
simple:-).
I have read through its source code, and didn't find anything about 'copy on 
write'.
I wonder wthat "COW" stands for?


--

Regards,
shhuiw


Re: [Qemu-discuss] network latency for virtio-net-pci

2014-09-02 Thread George Shuklin

On 09/02/2014 06:05 AM, Zhang Haoyu wrote:

We running qemu 1.5, and one of the users complains on high latency on
the overlay network of openstack.

I done some research and comparation and found those numbers:

V - virtual machine with qemu/virtio-net-pci tap device.
H - hardware server
S - hardware switch
O - openvswitch bridge (OVS 2.0)

V-O-V - 300 µs
V-H - 180 µs
H-S-H - 140 µs
V-O-S-O-V - 600 µs

After doing some math with linear equations and few more tests I found
following latencies:

internal linux latency - 50 µs
hardware switch latency - 40 µs
openvswitch (gre-mode) latency  40 µs

and, most important:

QEMU device - 130 µs

Did you use vhost-net?

Yep. Here command line for VM (network part)

qemu-system-x86_64 -machine accel=kvm:tcg ... -netdev 
tap,fd=25,id=hostnet0,vhost=on,vhostfd=26 -device 
virtio-net-pci,netdev=hostnet0,id=net0,mac=fa:16:3e:0e:4c:5c,bus=pci.0,addr=0x3 
...

2. Is any way to reduce latency for qemu network devices?


1) try to patch vhost: add polling mode
N.B., you can also introduce similar implementation to guest virtio driver.
2) try to patch Workqueue based vhost work scheduling
3) tune CFS paras for lower latency: sched_min_granularity_ns, 
sched_latency_ns, sched_wakeup_granularity_ns
4) renice vhost thread to higher priority(e.g., -10)
5) bind vcpu to pcpu


Thanks, I'll try.



Re: [Qemu-discuss] What does "COW" mean?

2014-09-02 Thread Jakob Bohm

On 02/09/2014 10:33, shhuiw wrote:

Hi,

I'm new to qemu community, and I'm trying the COW image format (old but 
simple:-).
I have read through its source code, and didn't find anything about 'copy on 
write'.
I wonder wthat "COW" stands for?
COW = Copy On Write is a general computing technique where something (in 
this case
a disk image file) doesn't really copy data until someone actual tries 
to write to
(change) their copy, then at that very moment, it makes a real copy for 
that someone

to write to.

In qemu context this is used when you make a "snapshot" copy of an 
entire virtual disk
and tells qemu that the running virtual machine should only write to one 
of the copies
while the other copies are kept unchanged for any reason (such as 
backup).  When you
tell qemu to do this with a COW disk image format, it just makes copies 
some data about
where different parts of the disk image are stored in the file, and sets 
some flags such
that when the virtual machine actually writes to the disk image, it is 
given its own
copy (in the COW file) of the part of the disk it has written to. For 
the (usually at least
90%) of the disk that the virtual machine doesn't write to, it just 
reads back from the

original copy without wasting time and disk space on an actual copy.

As a bonus feature, some recent versions of the qcow2 file format also 
uses this
technique for any part of the disk that contains all zeroes, which saves 
space as long
as the virtual machine doesn't completely fill its virtual disk. Reading 
back zeroes
from nowhere is faster and cheaper than reading zeroes from a real disk, 
making this

a win-win in most situations.

Enjoy

Jakob



Re: [Qemu-discuss] What does "COW" mean?

2014-09-02 Thread shhuiw


At 2014-09-02 04:33:50, "shhuiw"  wrote:
>
>
>Hi,
>
>I'm new to qemu community, and I'm trying the COW image format (old but 
>simple:-).
>I have read through its source code, and didn't find anything about 'copy on 
>write'.
>I wonder wthat "COW" stands for?

Sorry for my unclear expression.
I mean when copy-on-write happens if COW image format is used, and how the COW 
driver code handles cop-on-write?

>
>
>--
>
>Regards,
>shhuiw


--

Regards,
shhuiw