[Date Prev][Date Next] [Chronological] [Thread] [Top]

file descriptors



Probably a half-baked idea... Since select() works with file descriptors starting from 0 going upward, it might be helpful to arrange so that syslog and DB file descriptors are opened with high descriptor numbers, leaving the low range exclusively for sockets. On a server with many backends, or a database with many indices, those static descriptors can add up, and it's just wasted effort for select to walk through them.

e.g., at slapd startup time, before calling openlog(), something like:

   while(( fd = dup(0)) > 0 )
      if ( fd > slap_max_fd )
         slap_max_fd = fd;

   close(slap_max_fd--);
   openlog(...);

Likewise during the backend's db_open processing.
   close(slap_max_fd--);
   DB->open(...);
and open all of the DB index files in advance.

Then close all the remaining descriptors before the listener loop begins, to make them available for main processing.

Just a thought.

--
 -- Howard Chu
 Chief Architect, Symas Corp.  http://www.symas.com
 Director, Highland Sun        http://highlandsun.com/hyc
 OpenLDAP Core Team            http://www.openldap.org/project/