From owner-freebsd-net@FreeBSD.ORG Mon Jul 15 19:33:13 2013 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id F26D573 for ; Mon, 15 Jul 2013 19:33:13 +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 AAAAA314 for ; Mon, 15 Jul 2013 19:33:13 +0000 (UTC) Received: from smtp34.i.mail.ru (smtp34.i.mail.ru [94.100.177.94]) by fallback5.mail.ru (mPOP.Fallback_MX) with ESMTP id 2856BED9B983 for ; Mon, 15 Jul 2013 23:32:10 +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=hf9Io5kQsfDTxEbC/yMPEwPdrqlkZ5m4Cp58epvFt00=; b=PjMo8CplpUhxP/FjnUohfqz/AI/EEJvVngrU0unQT5lC8AAnmcs6OG7pd4+68s6jWUsOxzqbAeIag1bgJKOKpO20U5JeRJVJeirqoUI/NBB9d1vF+LwusMBT7+4+5lfd8T9zyYZgdk3Zt1a3UlIri+Rg90ADD1iGOyZnlDax/aI=; Received: from [50.156.108.197] (port=39544 helo=[192.168.1.116]) by smtp34.i.mail.ru with esmtpa (envelope-from ) id 1UyoV8-00015T-Nx; Mon, 15 Jul 2013 23:32:03 +0400 Message-ID: <51E44E2F.8060700@mail.ru> Date: Mon, 15 Jul 2013 12:31:59 -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: Sepherosa Ziehau Subject: Re: SO_REUSEPORT: strange kernel balancer behaviour References: <51E0E2AF.7090404@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: 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 19:33:14 -0000 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 >