Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 25 Feb 2005 07:33:04 -0800
From:      Bakul Shah <bakul@BitBlocks.com>
To:        "Baris Simsek" <simsek@enderunix.org>
Cc:        freebsd-performance@freebsd.org
Subject:   Re: unix domain sockets vs. internet sockets 
Message-ID:  <200502251533.j1PFX4OS056850@gate.bitblocks.com>
In-Reply-To: Your message of "Fri, 25 Feb 2005 09:02:45 %2B0200." <20050225070246.35459.qmail@istanbul.enderunix.org> 

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

> 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. What are the differences 
> between impelementations of them at kernel level? 

If you *don't want* remote processes access to your daemon,
use unix sockets and you don't have to worry about security
issues as much.  This is the main reason for choosing one
over the other.  You should also structure your code so that
you can change the choice later (as well as use SSL if
necessary).

Answering what you didn't ask :-)
Socket implementation performance differences is the wrong
thing to worry about this early in the game.  Instead of
trying to make it `as fast as possible', it might make more
sense to think about what is the expected load (or setting
load goals) and how to meet the required performance by
making sure the machine has enough resources and making sure
you can measure relevant performance parameters at any time.
How you modularize your daemon, protocol design (if you have
control over it), available memory, disk speed and data
organization (if you are accessing lots of data), algorithm
design, whether you can distribute load across machines etc.
will have a much bigger influence on overall performance than
the choice of socket type.  You *never* have enough time to
optimize everything so setting realistic performance goals
helps you meet them sooner -- you fix the top N bottlenecks
(which change as you tighten things) and stop when done!

help

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