From owner-freebsd-net@FreeBSD.ORG Mon Jul 15 20:06:29 2013 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 09B522EF; Mon, 15 Jul 2013 20:06:29 +0000 (UTC) (envelope-from trafdev@mail.ru) Received: from fallback5.mail.ru (fallback5.mail.ru [94.100.176.59]) by mx1.freebsd.org (Postfix) with ESMTP id 811AE85F; Mon, 15 Jul 2013 20:06:28 +0000 (UTC) Received: from smtp3.mail.ru (smtp3.mail.ru [94.100.176.131]) by fallback5.mail.ru (mPOP.Fallback_MX) with ESMTP id B2350ED9F3CF; Tue, 16 Jul 2013 00:04:47 +0400 (MSK) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mail.ru; s=mail2; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:References:Subject:CC:To:MIME-Version:From:Date:Message-ID; bh=DKLv2iT3gm7vawe9j4Ixd+HwfaxL8QWdUCULi4TBstA=; b=Ja7BQQqbNU9aQ8GAtozfqpVmrmQyTMWZvKry9PpHGRhsfyW4etSGMQ+oXaCeiogZbZaHgUJWxSvPul+59Jg+HaK37764K7pz6g8eWe0ePvJh1ZiPxJWLcb6bA64IlvOy6fx1C6fbbHxST0MHe1t40w1YqU/PAZ8PuB45Nry4VBc=; Received: from [50.156.108.197] (port=62579 helo=[192.168.1.116]) by smtp3.mail.ru with esmtpa (envelope-from ) id 1Uyp0i-00037q-3y; Tue, 16 Jul 2013 00:04:40 +0400 Message-ID: <51E455D5.2090403@mail.ru> Date: Mon, 15 Jul 2013 13:04:37 -0700 From: trafdev User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/20130628 Thunderbird/17.0.7 MIME-Version: 1.0 To: Adrian Chadd Subject: Re: SO_REUSEPORT: strange kernel balancer behaviour References: <51E0E2AF.7090404@mail.ru> <51E44E2F.8060700@mail.ru> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam: Not detected X-Mras: Ok Cc: Sepherosa Ziehau , freebsd-net@freebsd.org X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Jul 2013 20:06:29 -0000 Yep I think it's wasting of resources, poll manager should somehow be configured to update only one process/thread. Anyone know how to do that? Thanks. On Mon Jul 15 12:53:55 2013, Adrian Chadd wrote: > i've noticed this when doing this stuff in a threaded program with > each thread listening on the same port. > > All threads wake up on each accepted connection, one thread wins and > the other threads get EAGAIN. > > > > -adrian > > On 15 July 2013 12:31, trafdev wrote: >> Thanks for reply. >> >> This approach produces lot of "resource temporary unavailable" (eagain) on >> accept-ing connections in N-1 processes. >> Is this possible to avoid this by e.g. tweaking kqueue? >> >> >> On Sun Jul 14 19:37:59 2013, Sepherosa Ziehau wrote: >>> >>> On Sat, Jul 13, 2013 at 1:16 PM, trafdev wrote: >>>> >>>> Hello. >>>> >>>> Could someone help with following problem of SO_REUSEPORT. >>> >>> >>> The most portable "load balance" between processes listening on the >>> same TCP addr/port probably is: >>> >>> s=socket(); >>> bind(s); >>> listen(s); >>> /* various socketopt and fcntl as you needed */ >>> pid=fork(); >>> if (pid==0) { >>> server_loop(s); >>> exit(1); >>> } >>> server_loop(s); >>> exit(1); >>> >>> Even in Linux or DragonFly SO_REUSEPORT "load balance" between >>> processes listening on the same TCP addr/port was introduced recently, >>> so you probably won't want to rely on it. >>> >>> Best Regards, >>> sephe >>> >> _______________________________________________ >> freebsd-net@freebsd.org mailing list >> http://lists.freebsd.org/mailman/listinfo/freebsd-net >> To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org" > >