From dev-return-11943-apmail-apr-dev-archive=apr.apache.org@apr.apache.org Sun Jun 06 06:08:34 2004 Return-Path: Delivered-To: apmail-apr-dev-archive@www.apache.org Received: (qmail 30783 invoked from network); 6 Jun 2004 06:08:34 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 6 Jun 2004 06:08:34 -0000 Received: (qmail 12985 invoked by uid 500); 6 Jun 2004 06:08:36 -0000 Delivered-To: apmail-apr-dev-archive@apr.apache.org Received: (qmail 12833 invoked by uid 500); 6 Jun 2004 06:08:35 -0000 Mailing-List: contact dev-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Delivered-To: mailing list dev@apr.apache.org Received: (qmail 12820 invoked by uid 99); 6 Jun 2004 06:08:35 -0000 X-AuthUser: chip@force-elite.com Subject: [PATCH] KQueue AND sys_epoll Support for apr_pollset From: Paul Querna To: dev@apr.apache.org Content-Type: text/plain Message-Id: <1086502102.13777.30.camel@localhost> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.5.7 Date: Sat, 05 Jun 2004 23:08:22 -0700 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Based on my work from earlier this week, I have a new Patch. On Joe Orton's advice I removed the sys_epoll backend for apr_poll(). The more scalable platform specific backends will only be used by apr_pollset(). As Joe explained, the extra overhead of sys_epoll or KQueue in apr_poll() would of likely made them slower than the original poll() version for small numbers of sockets.(common case) This version includes support for FreeBSD's KQueue(). It has only been tested on FreeBSD-5.2-CURRENT with HTTPd's Worker MPM. It needs to be tested on the NetBSD, OpenBSD and older versions of FreeBSD. Simple Benchmarks on my LAN with ab: FreeBSD KQueue(): 511.24 [requests/sec] FreeBSD Poll(): 430.56 [requests/sec] I was quite surprised with this performance increase (about 18% faster). I believe most of the performance gain comes from lower latency KQueue can offer over traditional poll(). The KQueue() Implmentation does not handle all the flags for apr_pollset(). The fact is FreeBSD's KQueue does not have an exact API match with traditional poll().[POLLPRI,POLLERR,POLLHUP,POLLNVAL]. It still passes all the tests, and seems to work great with HTTPd, but I believe it will hit some inconsistencies compared to how poll() behaves. Suggestions and Comments Welcome. -Paul Querna