apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lieven Govaerts <...@apache.org>
Subject [PATCH] reduce the number of kevent calls (kqueue on BSD)
Date Sun, 04 May 2014 19:42:33 GMT
Hi,


a call to apr_pollset_add or apr_pollset_remove with both APR_POLLIN
and APR_POLLOUT event filters requested will result in two kevent
system calls, where only one is needed.

Attached patch will fix that. I've tested both the pollset and pollcb
API's with this patch on Mac OS X with a modified serf client (with
10..100..1000 connections) and everything works as expected.

It's difficult to measure the performance benefits this brings. While
I see that the nr. of calls to kevent goes down and the time spent in
that call too, the margin of error on the total runtime of my tests is
much bigger than the time gained with the reduced nr. of kevent alls.

But, given that one of the benefits of kqueue is the possibility to
modify multiple event filters with one system call, I think making
this change is the right thing to do.

regards,

Lieven

[[[
Combine multiple kevent calls into one.

* poll/unix/kqueue.c
  (struct apr_pollset_private_t): Remove the kevent member variable here, it
      can be defined in the function scope of functions where needed.
  (impl_pollset_add, impl_pollset_remove,
   impl_pollcb_add, impl_pollcb_remove): Create both the event structures for
       APR_POLLIN and APR_POLLOUT first, then call kevent once with both.
]]]

Mime
View raw message