tsocket: optimize tdgram_bsd a lot master4-tdgram
authorStefan Metzmacher <metze@samba.org>
Thu, 2 Apr 2009 08:36:03 +0000 (10:36 +0200)
committerStefan Metzmacher <metze@samba.org>
Thu, 2 Apr 2009 15:25:05 +0000 (17:25 +0200)
commit1b0bb8dee32237486ec2db8a6d18f4baaa314cff
tree511962e8a1c800b87de2c610ff82c9ce47b75cc0
parent5ae86448363e2b39c2e9745eac07a205fac30dd2
tsocket: optimize tdgram_bsd a lot

The desire is to do as less syscalls during the
tdgram_sendto_send/recv() and tdgram_recvfrom_send/recv()
operations.

1. we first try the sendto()/recvfrom() syscall and
   only use a fd event if we got EAGAIN.

2. we cache the fd event and only change it's flags
   if really needed.

For the highload case we do almost no epoll_ctl() and epoll_wait()/select()
syscalls anymore. This speeds up the LDAP-BENCH-CLDAP test
by more than 20%. (With a modified version of this test
which let the server skip any ldb calls and just return success
I'm getting about 8000 requests per second, while I'm getting
just about 6000 requests per second without optimization)

metze
lib/tsocket/tsocket_bsd.c