tevent in multithreaded programs

Volker Lendecke Volker.Lendecke at SerNet.DE
Fri Jan 30 13:35:32 MST 2015

On Fri, Jan 30, 2015 at 03:27:14PM -0500, Jeff Layton wrote:
> No, not really, but it's possible that we may have multiple listener
> sockets, as well as activity on the connected sockets. The basic idea
> is to keep as much out of the event loop as possible, as we want to keep
> it able to deal with new socket events.
> It may turn out to be much ado about nothing, of course. Maybe accept
> handling and registering a new event is so lightweight that it's better
> to do it in the context of the event loop and call it good enough. I
> still like the basic idea of parallellizing as much as possible though.

If you want to optimize at that level I think tevent is too heavy-weight
for you. You should do direct epoll with a cache of malloc'ed state
records. tevent involves talloc and thus malloc which is too expensive
to really squeeze the last cycle out of the code. The main performance
killer for you will be the tevent_add_fd user space code. tevent is
really, really handy for complex async code, but if you have a lot of
variation in which sockets to handle, you got a problem. Long-running
connections, sure, web-like traffic, no.


SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de, mailto:kontakt at sernet.de

More information about the samba-technical mailing list