apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "William A. Rowe, Jr." <wr...@rowe-clan.net>
Subject Re: [PATCH] speed up apr_pollset_remove
Date Fri, 05 Jan 2007 19:27:33 GMT
Greg Ames wrote:
> the current apr_pollset_remove has an O(n**2) scaling issue which is
> likely to degrade the perfomance of the httpd Event MPM when it is
> handling lots of connections.  I've been playing with the following
> patch off and on but never posted it before due to day job pressures. 
> it serves pages for me but hasn't been stress tested.
> 
> the basic idea is to exploit the fact that the internal pfd_elem_t and
> apr_pollfd_t occupy the same chunk of memory.  by twiddling the internal
> structure, the pointer to one is the pointer to both and no search is
> needed.  this only changes the epoll implementation; kqueue looks like
> it could work the same.
> 
> comments?

Nice...

> --- ../apr/include/arch/unix/apr_arch_poll_private.h	(revision 492706)
> +++ ../apr/include/arch/unix/apr_arch_poll_private.h	(working copy)
> @@ -91,8 +91,8 @@
>  typedef struct pfd_elem_t pfd_elem_t;
>  
>  struct pfd_elem_t {
> +    apr_pollfd_t pfd;
>      APR_RING_ENTRY(pfd_elem_t) link;
> -    apr_pollfd_t pfd;

Since /include/arch/unix/apr_* are private, you should be able to slipstream
this in at whatever point you want.

Mime
View raw message