From owner-freebsd-performance@FreeBSD.ORG Fri Feb 25 07:21:10 2005 Return-Path: Delivered-To: freebsd-performance@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0714116A4CE for ; Fri, 25 Feb 2005 07:21:10 +0000 (GMT) Received: from gandalf.online.bg (gandalf.online.bg [217.75.128.9]) by mx1.FreeBSD.org (Postfix) with SMTP id 559F943D39 for ; Fri, 25 Feb 2005 07:21:08 +0000 (GMT) (envelope-from roam@ringlet.net) Received: (qmail 3454 invoked from network); 25 Feb 2005 07:21:04 -0000 Received: from unknown (HELO straylight.ringlet.net) (213.16.36.104) by gandalf.online.bg with SMTP; 25 Feb 2005 07:21:04 -0000 Received: (qmail 2096 invoked by uid 1000); 25 Feb 2005 07:21:05 -0000 Date: Fri, 25 Feb 2005 09:21:05 +0200 From: Peter Pentchev To: Baris Simsek Message-ID: <20050225072105.GA1139@straylight.m.ringlet.net> References: <20050225070246.35459.qmail@istanbul.enderunix.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="1yeeQ81UyVL57Vl7" Content-Disposition: inline In-Reply-To: <20050225070246.35459.qmail@istanbul.enderunix.org> User-Agent: Mutt/1.5.8i cc: freebsd-performance@freebsd.org Subject: Re: unix domain sockets vs. internet sockets X-BeenThere: freebsd-performance@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Performance/tuning List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Feb 2005 07:21:10 -0000 --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--