Return-Path: Delivered-To: apmail-apr-dev-archive@www.apache.org Received: (qmail 33812 invoked from network); 4 Jul 2005 09:18:32 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 4 Jul 2005 09:18:32 -0000 Received: (qmail 24529 invoked by uid 500); 4 Jul 2005 09:18:29 -0000 Delivered-To: apmail-apr-dev-archive@apr.apache.org Received: (qmail 24492 invoked by uid 500); 4 Jul 2005 09:18:29 -0000 Mailing-List: contact dev-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Id: Delivered-To: mailing list dev@apr.apache.org Received: (qmail 24478 invoked by uid 99); 4 Jul 2005 09:18:28 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 04 Jul 2005 02:18:28 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of jorton@redhat.com designates 66.187.233.31 as permitted sender) Received: from [66.187.233.31] (HELO mx1.redhat.com) (66.187.233.31) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 04 Jul 2005 02:18:30 -0700 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.11/8.12.11) with ESMTP id j649IPvn019639 for ; Mon, 4 Jul 2005 05:18:25 -0400 Received: from radish.cambridge.redhat.com (radish.cambridge.redhat.com [172.16.18.90]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id j649IMV31408 for ; Mon, 4 Jul 2005 05:18:25 -0400 Received: (from jorton@localhost) by radish.cambridge.redhat.com (8.13.4/8.13.4/Submit) id j649IL73020837 for dev@apr.apache.org; Mon, 4 Jul 2005 10:18:21 +0100 X-Authentication-Warning: radish.cambridge.redhat.com: jorton set sender to jorton@redhat.com using -f Date: Mon, 4 Jul 2005 10:18:21 +0100 From: Joe Orton To: dev@apr.apache.org Subject: Re: pollset initialization within apr_file_open()? Message-ID: <20050704091821.GA20411@redhat.com> Mail-Followup-To: dev@apr.apache.org References: <028168E4-9F12-4CD1-887C-AE86BFAC4CCD@apache.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <028168E4-9F12-4CD1-887C-AE86BFAC4CCD@apache.org> User-Agent: Mutt/1.4.2.1i X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N On Sun, Jul 03, 2005 at 04:27:05PM -0700, Brian Pane wrote: > I just did some performance profiling of httpd-2.1 for the first time > in a long while. > > One of the odd things I noticed is that apr_file_open() appears to > spend half its time > in a call to apr_pollset_create(). > > The pollset creation can be expensive, especially on platforms where > it's implemented using /dev/poll or kqueue. And as far as I can tell. > the pollset is only used in the special case of > apr_wait_for_io_or_timeout() where the caller wants to wait on a file. Note that this problem only affects the very small number of platforms without a (working) poll() implementation. > I'm inclined to think that the pollset within an apr_file_t should be > created only if needed--e.g., with lazy initialization triggered via > an apr_file_get_pollset() function. Such a function wouldn't be > thread-safe without some extra synchronization, of course, but that's > true of many of the apr_file_* and apr_pollset_* operations already. apr_wait_for_io_or_timeout could not be used from multiple threads for one file object already since the pollset use is not safe for such use either, so just creating the pollset there would probably work. The other alternative is just to implement the function using select(), but that then trades off against the FD_SETSIZE limitation. Possibly "use select if fd < FD_SETSIZE or fallback on creating a pollset" would be the most efficient for the normal case. joe