logoalt Hacker News

Veservtoday at 9:08 AM2 repliesview on HN

Says it is fast, but presents zero benchmarks to demonstrate it is actually fast or even “faster”. It is shameful to make up adjectives just to sound cool.


Replies

rwmjtoday at 9:45 AM

vsock is pretty widely used, and if you're using virtio-vsock it should be reasonably fast. Anyway if you want to do some quick benchmarks and have an existing Linux VM on a libvirt host:

(1) 'virsh edit' the guest and check it has '<vsock/>' in the <devices> section of the XML.

(2) On the host:

  $ nbdkit memory 1G --vsock -f
(3) Inside the guest:

  $ nbdinfo 'nbd+vsock://2'
(You should see the size being 1G)

And then you can try using commands like nbdcopy to copy data into and out of the host RAM disk over vsock. eg:

  $ time nbdcopy /dev/urandom 'nbd+vsock://2' -p
  $ time nbdcopy 'nbd+vsock://2' null: -p
On my machine that's copying at a fairly consistent 20 Gbps, but it's going to depend on your hardware.

To compare it to regular TCP:

  host $ nbdkit memory 1G -f -p 10809
  vm $ time nbdcopy /dev/urandom 'nbd://host' -p
  vm $ time nbdcopy 'nbd://host' null: -p
TCP is about 2.5x faster for me.

I had to kill the firewall on my host to do the TCP test (as trying to reconfigure nft/firewalld was beyond me), which actually points to one advantage of vsock, it bypasses the firewall. It's therefore convenient for things like guest agents where you want them to "just work" without reconfiguration hassle.

show 5 replies
wyldfiretoday at 4:10 PM

It's probably faster than, say, an emulated UART port.

But likely no faster than a TCP socket across a virtio-net device.