On Tue, Oct 13, 2009 at 11:33:54AM -0700, Mark Crispin wrote:
> Doubling FD_SETSIZE to 2048 would increase the fd_set by a whole 128  
> bytes.  Oh, the horror!  How can we possibly afford it?  [Excuse the  
> venomous sarcasm, but this sort of baby-computer thinking has been an  
> ongoing problem with UNIX type systems.]
>
this has nothing to do with baby-computer thinking. select() is simply
an incredibly inefficient interface, as it requires transforming the
bitmap(s) into wakeup lists on every call (unless it can return
immediately, in which case it is "only" iterating over all set fds).
this doesn't scale at all for busy servers - that's why linux introduced
the epoll() interface. so fd_set is kept small.

this particular problem is a bit of a corner case - it results from
having a lot of "dead" (as far as select() goes) descriptors and only a
few ones to actually poll. this basically happens only because c-client
and other code which has a completely different fd usage pattern are
mixed in one environment. a lot of other libraries will have the same
problem, so fixing c-client doesn't sound like a particularly
far-sighted solution. apache could solve that problem by putting
non-polled fds above the select() range (by using fcntl(..., F_DUPFD,
...)), or, if the thing runs in a separate process, by closing all
unused fds after the fork() (unfortunately, there is no automatic
close-on-fork flag, only a close-on-exec one ...).

> I didn't investigate further.  For some reason known only to the  
> developers of Linux, the includes and their mechanisms are incredibly  
> arcane.
>
that's mostly glibc as somebody else noted. you can have this arcanity
(?) on freebsd as well. :D

> Try looking for the errno definitions -- you have to go through  
> multiple levels of #include before you find them.
>
that's for abi compatibility with the "native" systems of given
platforms.

> If not, then the only  fix is to change tcp_unix.c to use poll()
> instead of select(),
>
one could do that ...

> and hope  that you never have to build c-client on a system that has
> select() but  not poll().
>
well, it's just a few #ifdefs more. systems without poll() are unlikely
to run apache nowadays. :)
_______________________________________________
Imap-uw mailing list
Imap-uw@u.washington.edu
http://mailman2.u.washington.edu/mailman/listinfo/imap-uw

Reply via email to