From owner-freebsd-hackers@FreeBSD.ORG Fri Aug 18 13:52:05 2006 Return-Path: X-Original-To: freebsd-hackers@FreeBSD.ORG Delivered-To: freebsd-hackers@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4B43616A4DE for ; Fri, 18 Aug 2006 13:52:05 +0000 (UTC) (envelope-from olli@lurza.secnetix.de) Received: from lurza.secnetix.de (lurza.secnetix.de [83.120.8.8]) by mx1.FreeBSD.org (Postfix) with ESMTP id 497BD43D5C for ; Fri, 18 Aug 2006 13:52:04 +0000 (GMT) (envelope-from olli@lurza.secnetix.de) Received: from lurza.secnetix.de (ovsjiv@localhost [127.0.0.1]) by lurza.secnetix.de (8.13.4/8.13.4) with ESMTP id k7IDpuM4017150; Fri, 18 Aug 2006 15:52:02 +0200 (CEST) (envelope-from oliver.fromme@secnetix.de) Received: (from olli@localhost) by lurza.secnetix.de (8.13.4/8.13.1/Submit) id k7IDpubO017149; Fri, 18 Aug 2006 15:51:56 +0200 (CEST) (envelope-from olli) Date: Fri, 18 Aug 2006 15:51:56 +0200 (CEST) Message-Id: <200608181351.k7IDpubO017149@lurza.secnetix.de> From: Oliver Fromme To: freebsd-hackers@FreeBSD.ORG, martin.eugen@gmail.com In-Reply-To: <966ba91e0608180041v3cfd9dcfh80ef89aab5404f48@mail.gmail.com> X-Newsgroups: list.freebsd-hackers User-Agent: tin/1.8.0-20051224 ("Ronay") (UNIX) (FreeBSD/4.11-STABLE (i386)) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.1.2 (lurza.secnetix.de [127.0.0.1]); Fri, 18 Aug 2006 15:52:02 +0200 (CEST) X-Mailman-Approved-At: Fri, 18 Aug 2006 14:02:49 +0000 Cc: Subject: Re: SOCK_DGRAM optimization needed... X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: freebsd-hackers@FreeBSD.ORG, martin.eugen@gmail.com List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Aug 2006 13:52:05 -0000 Martin Eugen wrote: > I have a simple application, that deals with lots of dgram sockets (UDP). > Thousands of them. Basically, its purpose is to > maintain pairs of sockets and when data is received on one of the sockets it > peeks through it (doing some simple > statistic calculations) and then forwards it to the other socket. > Because of the hudge number of reads and writes (probably about a 10 packets > per second per socket pair) it generates a significant load > on the system, that I would like to minimize. I'm currently evaluating if it > would be possible to add simple 'routing' functionality in the socket layer > in the kernel, because frankly I'm not able to think of anything else. You should consider using kqueue(2) instead of select(2) or poll(2), because it's more efficient for large numbers of descriptors. Squid (from the ports collection) has grown kqueue support on FreeBSD some time ago, and it's definitely a win. You can look at the squid sources to see how it's done; it's not difficult. Best regards Oliver -- Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing Dienstleistungen mit Schwerpunkt FreeBSD: http://www.secnetix.de/bsd Any opinions expressed in this message may be personal to the author and may not necessarily reflect the opinions of secnetix in any way. "I started using PostgreSQL around a month ago, and the feeling is similar to the switch from Linux to FreeBSD in '96 -- 'wow!'." -- Oddbjorn Steffensen