3 ms·
What's in the way of TCP hitting the same performance as unix sockets, is it just netfilter?
by duped 3y ago
What's in the way of TCP hitting the same performance as unix sockets, is it just netfilter?
- woodruffw 3y agoI believe the conventional wisdom here is that UDS performs better because of fewer context switches and copies between userspace and kernelspace.
- foobiekr 3y agoNo. This is exactly the same. Think about life of a data gram or stream bytes on the syscall edge for each.
- woodruffw 3y agoI’m not sure I understand. This isn’t something I haven’t thought about in a while, but it’s pretty intuitive to me that a loopback TCP connection would pretty much always be slower: each transmission unit goes through the entire TCP stack, feeds into the TCP state machine, etc. Thats more time spent in the kernel.
- foobiekr 3y agoYea but those aren’t context switches.
- noselasd 3y agoTCP has a lot of rules nailed down in numerous RFCs - everything from how to handle sequence numbers, the 3-way handshake, congestion control, and much more. That translates into a whole lot of code that needs to run, while unix sockets are not that much more than a kernel buffer and code to copy data back and forth in that buffer - which doesn't need a lot of code to make happen.
- foobiekr 3y agoThe ip stack.