You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Brian Pane <br...@brianp.net> on 2005/07/05 00:25:14 UTC

poll on OS X Re: pollset initialization within apr_file_open()?

On Jul 4, 2005, at 2:18 AM, Joe Orton wrote:

> 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.

Ah, that explains it: I'm using OS X 10.4, and this recent change  
disabled
the use of poll in APR on Darwin:
<http://svn.apache.org/viewcvs.cgi/apr/apr/trunk/build/apr_hints.m4? 
rev=179282&r1=178653&r2=179282>

I can develop a patch to do a lazy initialization of the pollset  
within the
apr_file_t, which should fix the httpd performance problems.

However, one of the later comments in bug 34332 notes that "disabling
poll() may not be necessary" on Darwin after all.  If anybody is  
actively
looking at the possibility of reenabling poll() on Darwin, please let me
know and I'll hold off on implementing the lazy-initialization fix  
for now.

Thanks,
Brian


Re: poll on OS X Re: pollset initialization within apr_file_open()?

Posted by Joe Orton <jo...@redhat.com>.
On Mon, Jul 04, 2005 at 03:25:14PM -0700, Brian Pane wrote:
> On Jul 4, 2005, at 2:18 AM, Joe Orton wrote:
> >On Sun, Jul 03, 2005 at 04:27:05PM -0700, Brian Pane wrote:
> >>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.
> 
> Ah, that explains it: I'm using OS X 10.4, and this recent change 
> disabled the use of poll in APR on Darwin: 
> <http://svn.apache.org/viewcvs.cgi/apr/apr/trunk/build/apr_hints.m4?  
> rev=179282&r1=178653&r2=179282>
> 
> I can develop a patch to do a lazy initialization of the pollset 
> within the apr_file_t, which should fix the httpd performance 
> problems.

OK, possibly it should be done for the apr_socket_t case too.

> However, one of the later comments in bug 34332 notes that "disabling 
> poll() may not be necessary" on Darwin after all.  If anybody is 
> actively looking at the possibility of reenabling poll() on Darwin, 
> please let me know and I'll hold off on implementing the 
> lazy-initialization fix for now.

That comment was not the last word on the topic; I've just added a link 
to Fred's last message.

Regards,

joe