Changing transports means if you want to move your grpc server process to a different box you now have new runtime configuration to implement/support and new performance characteristics to test.
I can see some of the security benefits if you are running on one host, but I also don't buy the advantages highlighted at the end of the article about using many different OS's and language environments on a single host. Seems like enabling and micro-optimising chaos instead of trying to tame it.
Particularly in the ops demo: Statically linking a C++ grpc binary, and standardising on host OS and gcc-toolset, doesn't seem that hard. On the other hand, if you're using e.g. a python rpc server are you even going to be able to feel the impact of switching to vsock?
I think this is supposed to be option for when you want to pass stuff to host quickly without writing another device driver or using other interface rather than replacement for any rpc between VMs. "Being fast" is just a bonus.
For example at our job we use serial port for the communication with VM agent (it's just passing some host info about where VM is running, so our automation system can pick it up), this would be ideal replacement for that.
And as it is "just a socket", stuff like this is pretty easy to setup https://libvirt.org/ssh-proxy.html
I think the use of Bazel and gRPC in the article distracts from understanding how vsock works. I found this article[1] much more approachable.
[1]: https://medium.com/@F.DL/understanding-vsock-684016cf0eb0
This should have been a VM with a basic server and socat’ing the vsocket. I don’t know why so much space was dedicated to unrelated topics. Also zero qualifications or benchmarks for “fast” compared to tcp/virtio.
Author says “no ssh keys” when ssh is an orthogonal concept. sshd can listen on a vsock interface, it’s not specific to tcp/ip.
From the “Under the hood” section, which should be the part actually about vsock:
> I haven’t delved into the low-level system API for vsocks, as frameworks typically abstract this away.
This is just what happens when you use bazel to quickly set up your project.
Veserv•2mo ago
rwmj•2mo ago
(1) 'virsh edit' the guest and check it has '<vsock/>' in the <devices> section of the XML.
(2) On the host:
(3) Inside the guest: (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:
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:
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.
gpderetta•2mo ago
rwmj•2mo ago
The difference between nbdcopy ... /dev/null and nbdcopy ... null: is that in the second case we avoid writing the data anywhere and just throw it away inside nbdcopy.
imiric•2mo ago
nly•2mo ago
I presume this is down to much larger buffers in the TCP stack.
rwmj•2mo ago
Edit: I patched both ends to change SO_SNDBUF and SO_RCVBUF from the default (both 212992) to 4194304, and that made no difference.
Veserv•2mo ago
2.5x slower than what they were replacing. Demanding evidence for claims strikes again.
rwmj•2mo ago
Having said that, yes it also really ought to be faster. It's a decent, modern protocol so there's no particular reason for it, so with a bit of tuning somewhere it should be possible.
happyPersonR•2mo ago
rwmj•2mo ago
mananaysiempre•2mo ago
tuetuopay•2mo ago
This. The point of vsock is not performance, it's the zero-configuration aspect of them. No IP address plan. No firewall. No DHCP. No nothing. Just a network-like API for guest-host communication for guest agents and configuration agents. Especially useful to fetch a configuration without having a configuration.
IMHO the "fast" in the original article should be read as "quick to setup", not as "high bandwidth".
wyldfire•2mo ago
But likely no faster than a TCP socket across a virtio-net device.