Date: Fri, 18 Aug 2006 15:51:56 +0200 (CEST) From: Oliver Fromme <olli@lurza.secnetix.de> To: freebsd-hackers@FreeBSD.ORG, martin.eugen@gmail.com Subject: Re: SOCK_DGRAM optimization needed... Message-ID: <200608181351.k7IDpubO017149@lurza.secnetix.de> In-Reply-To: <966ba91e0608180041v3cfd9dcfh80ef89aab5404f48@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Martin Eugen <martin.eugen@gmail.com> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200608181351.k7IDpubO017149>