Re: sched_yield() makes OpenLDAP slow

From: Howard Chu
Date: Mon Aug 22 2005 - 17:45:11 EST


Florian Weimer wrote:
* Andi Kleen:

Has anybody contacted the Sleepycat people with a description of the problem yet?

Berkeley DB does not call sched_yield, but OpenLDAP does in some
wrapper code around the Berkeley DB backend.
That's not the complete story. BerkeleyDB provides a db_env_set_func_yield() hook to tell it what yield function it should use when its internal locking routines need such a function. If you don't set a specific hook, it just uses sleep(). The OpenLDAP backend will invoke this hook during some (not necessarily all) init sequences, to tell it to use the thread yield function that we selected in autoconf.

Note that (on systems that support inter-process mutexes) a BerkeleyDB database environment may be used by multiple processes concurrently. As such, the yield function that is provided must work both for threads within a single process (PTHREAD_SCOPE_PROCESS) as well as between processes (PTHREAD_SCOPE_SYSTEM). The previous comment about slapd only needing to yield within a single process is inaccurate; since we allow slapcat to run concurrently with slapd (to allow hot backups) we need BerkeleyDB's locking/yield functions to work in System scope.

--
-- 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/

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/