From owner-freebsd-current@FreeBSD.ORG Thu May 29 21:54:46 2014 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 49AE1DC6 for ; Thu, 29 May 2014 21:54:46 +0000 (UTC) Received: from smtp.rlwinm.de (smtp.rlwinm.de [IPv6:2a01:4f8:201:31ef::e]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0BBFC2C1C for ; Thu, 29 May 2014 21:54:46 +0000 (UTC) Received: from hexe.rlwinm.de (p57A7C4D0.dip0.t-ipconnect.de [87.167.196.208]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by smtp.rlwinm.de (Postfix) with ESMTPSA id 190A811280 for ; Thu, 29 May 2014 23:54:44 +0200 (CEST) Message-ID: <5387ACA3.3090108@rlwinm.de> Date: Thu, 29 May 2014 23:54:43 +0200 From: Jan Bramkamp User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 To: 'freebsd-current' Subject: Re: RES: KQueue vs Select (NetMap) References: <00c301cf7aee$b00caea0$10260be0$@rlwinm.de> <00d301cf7af9$d5ce5bb0$816b1310$@freebsd.org> In-Reply-To: X-Enigmail-Version: 1.6 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 May 2014 21:54:46 -0000 On 29.05.2014 06:57, Fred Pedrisa wrote: > Hello, > > There are 4 threads, and a total of 32 FDs. What do you think ? > > -----Mensagem original----- > De: owner-freebsd-current@freebsd.org > [mailto:owner-freebsd-current@freebsd.org] Em nome de Adrian Chadd > Enviada em: quinta-feira, 29 de maio de 2014 01:52 > Para: Fred Pedrisa > Cc: freebsd-current; Jan Bramkamp > Assunto: Re: KQueue vs Select (NetMap) > > If your netmap thread(s) just have one or two FDs in some low range (say, > under FD 8 or 10) - no. > > If you have a whole bunch of active FDs and your netmap threads get FDs that > are high - then yes. select() operates on a bitmap of FD numbers. So if your > netmap FD is like, FD 8 and it's the highest FD that you're interested in, > select() only has to scan up to that FD. So it scans up to 8 FDs. If you > have a very active program and it has thousands of FDs open, select() has to > check all the FDs in the bitmap to see if they're set before getting to your > netmap FD. If your threads use just a handful of small FDs than you shouldn't see any performance difference between select()/poll() and kqueue(). But kqueue() can block on multiple event types. This can simply your netmap threads main loop. It sometimes even enables you to get by with just one type of main loop instead of multiple different main loops for different interfaces e.g. one for timers, one for sockets and one for files.