linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* SO_REUSEPORT and Unix domain sockets
@ 2014-05-27  9:55 Tobias Oberstein
  2014-09-20  1:44 ` Eduardo Silva
  0 siblings, 1 reply; 3+ messages in thread
From: Tobias Oberstein @ 2014-05-27  9:55 UTC (permalink / raw)
  To: LKML

Linux kernels >= 3.9 allow sharing of sockets between processes with 
in-kernel load-balancing by setting SO_REUSEPORT (eg 
http://lwn.net/Articles/542629/)

How can this be used for sockets of type AF_UNIX?

I can only get it working with TCP sockets, not Unix domain sockets.

When using TCP, the incoming clients will get nicely balanced to all 
processes listening. With Unix domain sockets, the incoming clients all 
get connected only to the last started process.

The test code (Python) I was trying is here:

http://stackoverflow.com/questions/23742368/can-so-reuseport-be-used-on-unix-domain-sockets

Any hints appreciated,
/Tobias

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: SO_REUSEPORT and Unix domain sockets
  2014-05-27  9:55 SO_REUSEPORT and Unix domain sockets Tobias Oberstein
@ 2014-09-20  1:44 ` Eduardo Silva
  2014-09-21 13:50   ` Tobias Oberstein
  0 siblings, 1 reply; 3+ messages in thread
From: Eduardo Silva @ 2014-09-20  1:44 UTC (permalink / raw)
  To: Tobias Oberstein; +Cc: LKML

>
> How can this be used for sockets of type AF_UNIX?
>
> I can only get it working with TCP sockets, not Unix domain sockets.
>
> When using TCP, the incoming clients will get nicely balanced to all
> processes listening. With Unix domain sockets, the incoming clients all get
> connected only to the last started process.
>
> The test code (Python) I was trying is here:
>
> http://stackoverflow.com/questions/23742368/can-so-reuseport-be-used-on-unix-domain-sockets
>
> Any hints appreciated,
> /Tobias


Looking at the original patch looks like the implementation is only
done for TCP and UDP:

     http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=c617f398edd4db2b8567a28e899a88f8f574798d

UNIX domain sockets use the file system as the address name space, so
SO_REUSEPORT would not be applicable.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: SO_REUSEPORT and Unix domain sockets
  2014-09-20  1:44 ` Eduardo Silva
@ 2014-09-21 13:50   ` Tobias Oberstein
  0 siblings, 0 replies; 3+ messages in thread
From: Tobias Oberstein @ 2014-09-21 13:50 UTC (permalink / raw)
  To: Eduardo Silva; +Cc: LKML

Am 20.09.2014 03:44, schrieb Eduardo Silva:
>>
>> How can this be used for sockets of type AF_UNIX?
>>
>> I can only get it working with TCP sockets, not Unix domain sockets.
>>
>> When using TCP, the incoming clients will get nicely balanced to all
>> processes listening. With Unix domain sockets, the incoming clients all get
>> connected only to the last started process.
>>
>> The test code (Python) I was trying is here:
>>
>> http://stackoverflow.com/questions/23742368/can-so-reuseport-be-used-on-unix-domain-sockets
>>
>> Any hints appreciated,
>> /Tobias
>
>
> Looking at the original patch looks like the implementation is only
> done for TCP and UDP:
>
>       http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=c617f398edd4db2b8567a28e899a88f8f574798d
>

Ok, I see. Unfortunate.

> UNIX domain sockets use the file system as the address name space, so
> SO_REUSEPORT would not be applicable.
>

Yes, in case of Unix domain sockets, it's about "reusing paths", not ports.

Such an option for in-kernel load-balancing of Unix domain sockets would 
be useful ..

/Tobias

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-09-21 13:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-27  9:55 SO_REUSEPORT and Unix domain sockets Tobias Oberstein
2014-09-20  1:44 ` Eduardo Silva
2014-09-21 13:50   ` Tobias Oberstein

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).