* [Qemu-devel] Measure virtio-vsock speed
@ 2016-12-15 9:00 Zhang Shuaiyi
2016-12-16 10:43 ` Stefan Hajnoczi
0 siblings, 1 reply; 2+ messages in thread
From: Zhang Shuaiyi @ 2016-12-15 9:00 UTC (permalink / raw)
To: qemu-devel; +Cc: stefanha
I used kernel 4.8 and qemu v2.8.0-rc3.
Qemu command line:
-device vhost-vsock-pci,id=vhost-vsock-pci0,guest-cid=3
I try to use nc-vsock to test vsock speed.
1. In host:
# modprobe vhost-vsock
# ./nc-vsock -l 1234 > /dev/null
2. In guest:
a. use pv and nc-vsock, speed is about 62MB/s.
# pv /dev/zero | ./nc-vsock 3 1234
b. use dd and nc-vsock, speed is about 67MB/s.
# dd if=/dev/zero bs=1M count=2000 | ./nc-vsock 3 1234
I think nc-vsock can not get the maximum speed, so I modified
nc-vsock.c.
1. In host, just recv data without printf.
2. In guest, use gettimeofday to record interval and send zero bufs.
#define MAXLEN 65536
char buf[MAXLEN] = {0};
unsigned long long num = 0;
gettimeofday(&start_time, NULL);
for (n = 0; n 1000000; n++) {
ret = send(fd, buf, MAXLEN, 0);
if (ret 0) {
fprintf(stderr, "send error ret:%d\n", ret);
break;
}
num += ret;
}
gettimeofday(&end_time, NULL);
In this way, the virtio-vsock speed is about 500MB/s. But use iperf to
test virtio-net, the speed is about 1.5GB/s.
Iperf can be used to test virtio-net, is there a tool to test maximum virtio-vsock speed?
At present, virtio-vsock is faster than virtio-net?
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [Qemu-devel] Measure virtio-vsock speed
2016-12-15 9:00 [Qemu-devel] Measure virtio-vsock speed Zhang Shuaiyi
@ 2016-12-16 10:43 ` Stefan Hajnoczi
0 siblings, 0 replies; 2+ messages in thread
From: Stefan Hajnoczi @ 2016-12-16 10:43 UTC (permalink / raw)
To: Zhang Shuaiyi; +Cc: qemu-devel, stefanha
[-- Attachment #1: Type: text/plain, Size: 2399 bytes --]
On Thu, Dec 15, 2016 at 05:00:35PM +0800, Zhang Shuaiyi wrote:
> I used kernel 4.8 and qemu v2.8.0-rc3.
> Qemu command line:
> -device vhost-vsock-pci,id=vhost-vsock-pci0,guest-cid=3
>
> I try to use nc-vsock to test vsock speed.
> 1. In host:
> # modprobe vhost-vsock
> # ./nc-vsock -l 1234 > /dev/null
> 2. In guest:
> a. use pv and nc-vsock, speed is about 62MB/s.
> # pv /dev/zero | ./nc-vsock 3 1234
> b. use dd and nc-vsock, speed is about 67MB/s.
> # dd if=/dev/zero bs=1M count=2000 | ./nc-vsock 3 1234
>
> I think nc-vsock can not get the maximum speed, so I modified
> nc-vsock.c.
Good idea, nc-vsock is not a performance benchmark.
> 1. In host, just recv data without printf.
> 2. In guest, use gettimeofday to record interval and send zero bufs.
> #define MAXLEN 65536
> char buf[MAXLEN] = {0};
> unsigned long long num = 0;
>
> gettimeofday(&start_time, NULL);
> for (n = 0; n 1000000; n++) {
> ret = send(fd, buf, MAXLEN, 0);
> if (ret 0) {
> fprintf(stderr, "send error ret:%d\n", ret);
> break;
> }
> num += ret;
> }
> gettimeofday(&end_time, NULL);
This is benchmarking how quickly send(2) returns but it doesn't
guarantee that the guest has received everything. Is it necessary to
add a final recv(fd, &status, sizeof(status), 0) to check that the other
side has seen all the data?
> In this way, the virtio-vsock speed is about 500MB/s. But use iperf to
> test virtio-net, the speed is about 1.5GB/s.
Your vsock benchmark may not be doing the same thing as iperf. I
suggest adding AF_VSOCK support to iperf for a fair comparison.
> Iperf can be used to test virtio-net, is there a tool to test maximum virtio-vsock speed?
> At present, virtio-vsock is faster than virtio-net?
I expect virtio-net to be faster than virtio-vsock and to remain faster
in the future. The goal of vsock is to provide reliable,
zero-configuration communication between guest and host. The goal is
not to be a faster transport than virtio-net.
If you are considering running something over AF_VSOCK for performance
reasons then that's not what it was designed for. If performance is the
*most* important thing look at vhost-user (i.e. shared memory) but it
has a lot of trade-offs because you need to implement virtio-net and a
network stack.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-12-16 10:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-15 9:00 [Qemu-devel] Measure virtio-vsock speed Zhang Shuaiyi
2016-12-16 10:43 ` Stefan Hajnoczi
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.