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

Max connections to slapd and getdtablesize()?



Hello,

If I understand the code in daemon.c correctly, the maximum number of simultaneous connections
to a slapd server are defined by FD_SETSIZE.

	#ifdef HAVE_SYSCONF
		dtblsize = sysconf( _SC_OPEN_MAX );
	#elif HAVE_GETDTABLESIZE
		dtblsize = getdtablesize();
	#else
		dtblsize = FD_SETSIZE
	#endif

	#ifdef FD_SETSIZE
		if(dtblsize > FD_SETSIZE) {
			dtblsize = FD_SETSIZE;
		}
	#endif  /* !FD_SETSIZE */

When running on Linux (kernel 2.2.14), the number of open files per process can be "tuned"
in <linux/fs.h> and <linux/limits.h> although I've yet to notice a difference (the ulimit
remains at 1024, although it can be increased by `root').

When `root' increases the limit in the shell (ulimit -n 8192) and then launches `slapd',
the latter still reports a dtablesize=1024 although 8192 files can be opened. I've tracked
it down to

	sysconf(_SC_OPEN_MAX) 	returns 8192
	getrlimit(RLIMIT_NOFILE) returns rlim_cur = 8192 but rlim_max = 1024
	getdtablesize() 	returns 8192
	FD_SETSIZE		remains at 1024

The above code forces the `dtblsize' down to 1024. Is this correct?

Regards,
	-JP