netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chris Friesen <cfriesen@nortelnetworks.com>
To: jamal <hadi@cyberus.ca>
Cc: linux-kernel@vger.kernel.org, netdev@oss.sgi.com,
	linux-net@vger.kernel.org
Subject: Re: anyone ever done multicast AF_UNIX sockets?
Date: Sun, 02 Mar 2003 01:03:03 -0500	[thread overview]
Message-ID: <3E619E97.8010508@nortelnetworks.com> (raw)
In-Reply-To: 20030228212309.C57212@shell.cyberus.ca

jamal wrote:
> Did you also measure throughput?

No.  lmbench doesn't appear to test UDP socket local throughput.

> You are overlooking the flexibility that already exists in IP based
> transports as an advantage; the fact that you can make them
> distributed instead of localized with a simple addressing change
> is a very powerful abstraction.

True.  On the other hand, the same could be said about unicast IP 
sockets vs unix sockets.  Unix sockets exist for a reason, and I'm 
simply proposing to extend them.

>>From
>>userspace, multicast unix would be *simple* to use, as in totally
>>transparent.

> You could implement the abstraction in user space as a library today by
> having some server that muxes to several registered clients.

This is what we have now, though with a suboptimal solution (we 
inherited it from another group).  The disadvantage with this is that it 
adds a send/schedule/receive iteration.  If you have a small number of 
listeners this can have a large effect percentage-wise on your messaging 
cost.  The kernel approach also cuts the number of syscalls required by 
a factor of two compared to the server-based approach.

> So whats the addressing scheme for multicast unix? Would it be a
> reserved path?

Actually I was thinking it could be arbitrary, with a flag in the unix 
part of struct sock saying that it was actually a multicast address. 
The api would be something like the IP multicast one, where you get and 
bind a normal socket and then use setsockopt to attach yourself to one 
or more of multicast addresses.  A given address could be multicast or 
not, but they would reside in the same namespace and would collide as 
currently happens.  The only way to create a multicast address would be 
the setsockopt call--if the address doesn't already exist a socket would 
be created by the kernel and bound to the desired address.

To see if its feasable I've actually coded up a proof-of-concept that 
seems to do fairly well. I tested it with a process sending an 8-byte 
packet containing a timestamp to three listeners, who checked the time 
on receipt and printed out the difference.

For comparison I have two different userspace implementations, one with 
a server process (very simple for test purposes) and the other using an 
mmap'd file to store which process is listening to what messages.

The timings (in usec) for the delays to each of the listeners were as 
follows on my duron 750:

userspace server:     104 133 153
userspace no server:   72 111 138
kernelspace:           60  91 113

As you can see, the kernelspace code is the fastest and since its in the 
kernel it can be written to avoid being scheduled out while holding 
locks which is hard to avoid with the no-server userspace option.

If this sounds at all interesting I would be glad to post a patch so you 
could shoot holes in it, otherwise I'll continue working on it privately.

Chris

-- 
Chris Friesen                    | MailStop: 043/33/F10
Nortel Networks                  | work: (613) 765-0557
3500 Carling Avenue              | fax:  (613) 765-2986
Nepean, ON K2H 8E9 Canada        | email: cfriesen@nortelnetworks.com

  reply	other threads:[~2003-03-02  6:03 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-27 20:09 anyone ever done multicast AF_UNIX sockets? Chris Friesen
2003-02-27 22:21 ` Greg Daley
2003-02-28 13:33 ` jamal
2003-02-28 14:39   ` Chris Friesen
2003-03-01  3:18     ` jamal
2003-03-02  6:03       ` Chris Friesen [this message]
2003-03-02 14:11         ` jamal
2003-03-03 18:02           ` Chris Friesen
2003-03-03 12:51 ` Terje Eggestad
2003-03-03 12:35   ` David S. Miller
2003-03-03 17:09   ` Chris Friesen
2003-03-03 16:55     ` David S. Miller
2003-03-03 18:07       ` Chris Friesen
2003-03-03 17:56         ` David S. Miller
2003-03-03 19:11           ` Chris Friesen
2003-03-03 18:56             ` David S. Miller
2003-03-03 19:42               ` Terje Eggestad
2003-03-03 21:32                 ` Chris Friesen
2003-03-03 23:38                   ` Terje Eggestad
2003-03-03 19:39     ` Terje Eggestad
2003-03-03 22:29       ` Chris Friesen
2003-03-03 23:29         ` Terje Eggestad
2003-03-04  2:38           ` jamal
     [not found] <3E5E7081.6020704@nortelnetworks.com.suse.lists.linux.kernel>
     [not found] ` <20030228083009.Y53276@shell.cyberus.ca.suse.lists.linux.kernel>
     [not found]   ` <3E5F748E.2080605@nortelnetworks.com.suse.lists.linux.kernel>
     [not found]     ` <20030228212309.C57212@shell.cyberus.ca.suse.lists.linux.kernel>
     [not found]       ` <3E619E97.8010508@nortelnetworks.com.suse.lists.linux.kernel>
     [not found]         ` <20030302081916.S61365@shell.cyberus.ca.suse.lists.linux.kernel>
     [not found]           ` <3E6398C4.2020605@nortelnetworks.com.suse.lists.linux.kernel>
2003-03-03 18:18             ` Andi Kleen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3E619E97.8010508@nortelnetworks.com \
    --to=cfriesen@nortelnetworks.com \
    --cc=hadi@cyberus.ca \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-net@vger.kernel.org \
    --cc=netdev@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).