tsocket: optimize tdgram_bsd a lot
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 19:54:00 +0000 (21:54 +0200)
commitc59ee5a139421762adb6f3f4bbfc21723c2ce407
tree5a10b23bf766bc5a654a2ce6f66a01fe232b35ca
parent85742dbc0651a3413e90afa18023cd55ae72e6db
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