nsqio / nsq

A realtime distributed messaging platform
https://nsq.io
MIT License
24.77k stars 2.89k forks source link

nsqd: support Unix Domain Sockets #723

Open jonathandelanders opened 8 years ago

jonathandelanders commented 8 years ago

We run nsqd over loopback and I believe performance could improve by using unix domain sockets. Using tcp/ip for interprocess communication over loopback requires the overhead of tcp/ip where using unix domain sockets do not as it was designed with local interprocess communication in mind. I should also note that we still would require the tcp/ip interface for the consumers... The socket would just be for our producers.

jehiah commented 8 years ago

@jonathandelanders I admit i don't use unix domain sockets much in my day to day, but there could totally be a value in being able to avoiding the tcp/ip overhead. Are you interested in contributing a PR that adds this feature?

jonathandelanders commented 8 years ago

I am... I admit however im not season'd in go yet. I have modified some of our existing code to use uds it isnt very complicated.. Most of it has to do with modifying the Dialers/net.Listen to use the "unix" mode instead of tcp. I'll ask one of our developers if they are interested first.

mreiferson commented 8 years ago

The real problem is no guaranteed ordering with UDP and the protocol expects packets to come in order. Many things would need to be modified to get this to work and then you've probably written a half-baked implementation of TCP anyway.

Not sure it's worth it, I'm -1.

Gibberish ^^

mreiferson commented 8 years ago

@jehiah pointed out to me offline that I completely misunderstood what you were suggesting here.

Carry on!

jonathandelanders commented 8 years ago

@mreiferson I just cancelled my long winded post on the difference between UDP and UDS :). Im pretty sure that internal/protocol/tcp_server.go can more or less be re-used here. However i see several pieces of code elsewhere that will need to be looked at. This may take some time for us to look at.

telepenin commented 1 year ago

PR for support unix sockets is provided