From owner-freebsd-current@FreeBSD.ORG Thu May 29 05:03:04 2014 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6095B4DE; Thu, 29 May 2014 05:03:04 +0000 (UTC) Received: from smtp2.wemm.org (smtp2.wemm.org [IPv6:2001:470:67:39d::78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "smtp2.wemm.org", Issuer "StartCom Class 1 Primary Intermediate Server CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 39FCB2B6D; Thu, 29 May 2014 05:03:04 +0000 (UTC) Received: from overcee.wemm.org (canning.wemm.org [192.203.228.65]) by smtp2.wemm.org (Postfix) with ESMTP id ADA1A619; Wed, 28 May 2014 22:03:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wemm.org; s=m20140428; t=1401339782; bh=Zcouh9A+5PO9cMfNUg3HV5If25DxrrJ3FFBHycYpIig=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=ukv8LuHybsXOqH3sYEBB2V8M2rAnZPdjkvXOm5pwN/0V269aCWGys3uegKnVuD0ZZ ZDvHDJeX6GS3+eAgAQTnAHvQXfjsMJTda99CakOzUJowF+fLIf59D6Si/j36sWjTBs I3nbsuTlM5T4FaeV8auawCBH1KkuNYg0N23SxQxc= From: Peter Wemm To: freebsd-current@freebsd.org Subject: Re: RES: KQueue vs Select (NetMap) Date: Wed, 28 May 2014 22:02:55 -0700 Message-ID: <3223163.UsW4aPcrLi@overcee.wemm.org> User-Agent: KMail/4.12.4 (FreeBSD/11.0-CURRENT; KDE/4.12.4; amd64; ; ) In-Reply-To: References: <00d301cf7af9$d5ce5bb0$816b1310$@freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart2657138.2G2PXJNEiH"; micalg="pgp-sha1"; protocol="application/pgp-signature" Cc: Fred Pedrisa , 'Adrian Chadd' , 'Jan Bramkamp' 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 05:03:04 -0000 --nextPart2657138.2G2PXJNEiH Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="us-ascii" On Thursday 29 May 2014 01:57:38 Fred Pedrisa wrote: > Hello, >=20 > There are 4 threads, and a total of 32 FDs. What do you think ? I think it is time for you to try it and find out... I suspect it wouldn't make much difference at all if you just implement= select=20 semantics with kqueue. =20 > -----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) >=20 > If your netmap thread(s) just have one or two FDs in some low range (= say, > under FD 8 or 10) - no. >=20 > If you have a whole bunch of active FDs and your netmap threads get F= Ds 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 inte= rested > 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, sele= ct() > has to check all the FDs in the bitmap to see if they're set before g= etting > to your netmap FD. >=20 > So yes. kqueue() is actually rather nice. >=20 >=20 >=20 > -a >=20 > On 28 May 2014 21:48, Fred Pedrisa wrote: > > Hello, > >=20 > > Ok, but in practice, is there any performance gain by moving from s= elect >=20 > to kQueue implementation ? Or is it not significant at all ? >=20 > > -----Mensagem original----- > > De: adrian.chadd@gmail.com [mailto:adrian.chadd@gmail.com] Em nome = de > > Adrian Chadd Enviada em: quinta-feira, 29 de maio de 2014 01:46 > > Para: Fred Pedrisa > > Cc: Jan Bramkamp; freebsd-current > > Assunto: Re: KQueue vs Select (NetMap) > >=20 > > The advantage is being able to include it in the rest of a kqueue I= O loop >=20 > where it's doing other things. >=20 > > -a > >=20 > > On 28 May 2014 20:53, Fred Pedrisa wrote: > >> Hello, > >>=20 > >> Yes, but kqueue support was added in recent commits as it says in = the > >> netmap changelog, is there any advantage ? > >>=20 > >> -----Mensagem original----- > >> De: owner-freebsd-current@freebsd.org > >> [mailto:owner-freebsd-current@freebsd.org] Em nome de Jan Bramkamp= > >> Enviada em: quinta-feira, 29 de maio de 2014 00:30 > >> Para: freebsd-current@freebsd.org > >> Assunto: Re: KQueue vs Select (NetMap) > >>=20 > >> On 29.05.2014 03:04, Fred Pedrisa wrote: > >>> Hey Guys, > >>>=20 > >>>=20 > >>>=20 > >>> How does kQueue performs over select with netmap ? > >>=20 > >> You are asking for a comparison between apples and oranges. Netmap= is > >> an API for high performance access to the low-level features of > >> modern NICs. It works on batches of frames in hardware queues. > >>=20 > >> The kqueue() and kevent() system calls are an event notification A= PI. > >> It is mostly used by application dealing with a large amount of > >> non-blocking sockets (or other file descriptors). It reduces overh= ead > >> inherent in > >> select() and poll() by preserving state between calls. It also > >> supports multiple types of events (read ready, write ready, timer > >> expired, async i/o, etc.). > >>=20 > >> Afaik the netmap pseudo-device supports only select() and poll(). > >> This is no performance problem because every thread will only deal= > >> with a small number of file descriptors to netmap devices. > >>=20 > >> Netmap is designed to bypass the FreeBSD IP stack (for most frames= ). > >> Kqueue is designed to scale to many sockets per process within the= > >> FreeBSD IP stack. > >> _______________________________________________ > >> freebsd-current@freebsd.org mailing list > >> http://lists.freebsd.org/mailman/listinfo/freebsd-current > >> To unsubscribe, send any mail to >=20 > "freebsd-current-unsubscribe@freebsd.org" >=20 > >> _______________________________________________ > >> freebsd-current@freebsd.org mailing list > >> http://lists.freebsd.org/mailman/listinfo/freebsd-current > >> To unsubscribe, send any mail to >=20 > "freebsd-current-unsubscribe@freebsd.org" >=20 > _______________________________________________ > freebsd-current@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-current > To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd= .org" >=20 > _______________________________________________ > freebsd-current@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-current > To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd= .org" =2D-=20 Peter Wemm - peter@wemm.org; peter@FreeBSD.org; peter@yahoo-inc.com; KI= 6FJV UTF-8: for when a ' just won\342\200\231t do. --nextPart2657138.2G2PXJNEiH Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part. Content-Transfer-Encoding: 7Bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (FreeBSD) iQEcBAABAgAGBQJThr+FAAoJEDXWlwnsgJ4EjJcH/iMhKyB/20fmLIhyPk2i8T8M C23MDhR9yQEwhg6clDj+HkoST19oFeGJqI7rJW2G8lKtjBWRF2Hvsd1OHFVPpbCL uRuHc3LDiDSHD9RtPSaqISlKQkjnKspMMHPJLAAeLZjb1ySF6iGtuvFbj4gcc5Gf TatnImzJfbGrvg9SuQnHncjNhNCwutuIXFYWI5RoS8hUGhqsOUSvMOh4UahOPmM1 tFgZh0S9NQmaaBOUNBKPMoBJ9IX7SW4H95qPnq3g1biYGbrx5MMoE89QqW+KbOo8 B3mvWLFFlI4/iQ5679AD1ZayqemKD3wVppCGyFZvzlgc3g/RJp6EypepZaYnhiQ= =XlKJ -----END PGP SIGNATURE----- --nextPart2657138.2G2PXJNEiH--