Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 25 Feb 2005 09:21:05 +0200
From:      Peter Pentchev <roam@ringlet.net>
To:        Baris Simsek <simsek@enderunix.org>
Cc:        freebsd-performance@freebsd.org
Subject:   Re: unix domain sockets vs. internet sockets
Message-ID:  <20050225072105.GA1139@straylight.m.ringlet.net>
In-Reply-To: <20050225070246.35459.qmail@istanbul.enderunix.org>
References:  <dc9ba044050203143647cee0c2@mail.gmail.com> <dc9ba044050224215466c95faa@mail.gmail.com> <20050225070246.35459.qmail@istanbul.enderunix.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--1yeeQ81UyVL57Vl7
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Fri, Feb 25, 2005 at 09:02:45AM +0200, Baris Simsek wrote:
> Hi,=20
>=20
> I am coding a daemon program. I am not sure about which type of
> sockets i should use. Could you compare ip sockets and unix domain
> sockets?  My main criterions are performance and protocol load.

The main point you should be thinking about is - should your daemon be
accessible by clients running on remote machines?  If so, Unix-domain
sockets are *definitely* not what you want, since they are, by design,
limited to connections on the same machine.  This is actually what makes
them a lot more efficient to use.

However, it would not be too hard to write your program so it is pretty
much independent of the type of sockets used - that's the point of the
Berkeley *sockets* intreface :)  If you drive carefully around the very
few things you can do *only* with Unix-domain sockets (for instance,
credential passing), and the very few things you can do *only* with
Internet-domain sockets (e.g. accept filters), and you handle the
address size/representation issue carefully (which in theory you should
anyway, what with IPv6 just around the corner... it seems ;), then your
program should have no trouble with listening on both/either type of
socket.  Actually, a lot of programs do that already, getting the best
of both worlds - the efficiency of Unix-domain sockets for local clients
and the ease of use of Internet-domain sockets for remote connections.

> What are the differences between impelementations of them at kernel
> level?=20

I'll have to let someone else answer that one :)

G'luck,
Peter

--=20
Peter Pentchev	roam@ringlet.net    roam@cnsys.bg    roam@FreeBSD.org
PGP key:	http://people.FreeBSD.org/~roam/roam.key.asc
Key fingerprint	FDBA FD79 C26F 3C51 C95E  DF9E ED18 B68D 1619 4553
This sentence contains exactly threee erors.

--1yeeQ81UyVL57Vl7
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (FreeBSD)

iD8DBQFCHtHh7Ri2jRYZRVMRAhxbAJ0SV+5IlROF/DbuWo9wiN/fF3pkgACeOjcY
abaL/GGTSzgT/t6LMbhwsII=
=x73A
-----END PGP SIGNATURE-----

--1yeeQ81UyVL57Vl7--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050225072105.GA1139>