[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
file descriptors
- To: OpenLDAP Devel <openldap-devel@OpenLDAP.org>
- Subject: file descriptors
- From: Howard Chu <hyc@symas.com>
- Date: Fri, 11 Nov 2005 01:43:54 -0800
- User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20051027 SeaMonkey/1.1a
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/