From: Howard Chu <hyc@symas.com>
To: Florian Weimer <fw@deneb.enyo.de>
Cc: Andi Kleen <ak@suse.de>, linux-kernel@vger.kernel.org
Subject: Re: sched_yield() makes OpenLDAP slow
Date: Mon, 22 Aug 2005 16:19:57 -0700 [thread overview]
Message-ID: <430A5D9D.90307@symas.com> (raw)
In-Reply-To: <87zmranm4m.fsf@mid.deneb.enyo.de>
Florian Weimer wrote:
> * Howard Chu:
> > 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.
> And this helps to increase performance substantially?
When the caller is a threaded program, yes, there is a substantial
(measurable and noticable) difference. Given that sleep() blocks the
entire process, the difference is obvious.
> > Note that (on systems that support inter-process mutexes) a
> > BerkeleyDB database environment may be used by multiple processes
> > concurrently.
>
> Yes, I know this, and I haven't experienced that much trouble with
> deadlocks. Maybe the way you structure and access the database
> environment can be optimized for deadlock avoidance?
Maybe we already did this deadlock analysis and optimization, years ago
when we first started developing this backend? Do you think everyone
else in the world is a total fool?
> > 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).
> If I understand you correctly, what you really need is a syscall
> along the lines "don't run me again until all threads T that share
> property X have run, where the Ts aren't necessarily in the same
> process". The kernel is psychic, it can't really know which
> processes to schedule to satisfy such a requirement. I don't even
> think "has joined the Berkeley DB environment" is the desired
> property, but something like "is part of this cycle in the wait-for
> graph" or something similar.
You seem to believe we're looking for special treatment for the
processes we're concerned with, and that's not true. If the system is
busy with other processes, so be it, the system is busy. If you want
better performance, you build a dedicated server and don't let anything
else make the system busy. This is the way mission-critical services are
delivered, regardless of the service. If you're not running on a
dedicated system, then your deployment must not be mission critical, and
so you shouldn't be surprised if a large gcc run slows down some other
activities in the meantime. If you have a large nice'd job running
before your normal priority jobs get their timeslice, then you should
certainly wonder wtf the scheduler is doing, and why your system even
claims to support nice() when clearly it doesn't mean anything on that
system.
> I would have to check the Berkeley DB internals in order to tell what
> is feasible to implement. This code shouldn't be on the fast path,
> so some kernel-based synchronization is probably sufficient.
pthread_cond_wait() probably would be just fine here, but BerkeleyDB
doesn't work that way.
--
-- 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/
next prev parent reply other threads:[~2005-08-22 23:20 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <43057641.70700@symas.com.suse.lists.linux.kernel>
[not found] ` <17157.45712.877795.437505@gargle.gargle.HOWL.suse.lists.linux.kernel>
[not found] ` <430666DB.70802@symas.com.suse.lists.linux.kernel>
2005-08-20 13:48 ` sched_yield() makes OpenLDAP slow Andi Kleen
2005-08-21 19:47 ` Florian Weimer
2005-08-22 5:09 ` Howard Chu
2005-08-22 13:06 ` Andi Kleen
2005-08-22 18:47 ` Howard Chu
2005-08-22 13:20 ` Florian Weimer
2005-08-22 23:19 ` Howard Chu [this message]
2006-01-24 22:59 e100 oops on resume Stefan Seyfried
2006-01-24 23:21 ` Mattia Dongili
2006-01-25 9:02 ` Olaf Kirch
2006-01-25 12:11 ` Olaf Kirch
2006-01-25 13:51 ` sched_yield() makes OpenLDAP slow Howard Chu
2006-01-25 14:38 ` Robert Hancock
2006-01-25 17:49 ` Christopher Friesen
2006-01-26 1:07 ` David Schwartz
2006-01-26 8:30 ` Helge Hafting
2006-01-26 9:01 ` Nick Piggin
2006-01-26 10:50 ` Nikita Danilov
[not found] <5uZqb-4fo-15@gated-at.bofh.it>
2006-01-14 22:47 ` Robert Hancock
-- strict thread matches above, loose matches on Subject: below --
2006-01-14 19:29 Howard Chu
[not found] <4D8eT-4rg-31@gated-at.bofh.it>
2005-08-20 3:20 ` Robert Hancock
2005-08-20 4:18 ` Nick Piggin
2005-08-20 18:38 ` Howard Chu
2005-08-20 20:57 ` Lee Revell
2005-08-20 21:24 ` Howard Chu
2005-08-21 0:36 ` Nick Piggin
2005-08-21 11:33 ` Nikita Danilov
2005-08-22 8:06 ` Howard Chu
2005-08-20 21:50 ` Lee Revell
2005-08-21 1:04 ` Robert Hancock
2005-08-22 11:44 ` linux-os (Dick Johnson)
2005-08-22 14:26 ` Robert Hancock
2005-08-23 11:17 ` linux-os (Dick Johnson)
2005-08-23 12:07 ` Denis Vlasenko
2005-08-24 3:37 ` Lincoln Dale
2005-08-19 6:03 Howard Chu
2005-08-19 6:34 ` Nick Piggin
2005-08-19 6:59 ` Chris Wedgwood
2005-08-19 22:45 ` Howard Chu
2005-08-19 10:21 ` Nikita Danilov
2005-08-19 23:10 ` Howard Chu
2005-08-20 13:23 ` Nikita Danilov
2005-08-20 19:49 ` Howard Chu
2005-08-20 22:08 ` Nikita Danilov
[not found] <4303DB48.8010902@develer.com.suse.lists.linux.kernel>
[not found] ` <20050818010703.GA13127@nineveh.rivenstone.net.suse.lists.linux.kernel>
[not found] ` <4303F967.6000404@yahoo.com.au.suse.lists.linux.kernel>
[not found] ` <43054D9A.7090509@develer.com.suse.lists.linux.kernel>
2005-08-19 3:19 ` Andi Kleen
2005-08-19 3:30 ` Bernardo Innocenti
2005-08-18 0:50 Bernardo Innocenti
2005-08-18 0:47 ` Con Kolivas
2005-08-18 10:48 ` Maciej Soltysiak
2005-08-18 1:07 ` Joseph Fannin
2005-08-18 2:25 ` Bernardo Innocenti
2005-08-18 2:58 ` Nick Piggin
2005-08-19 3:10 ` Bernardo Innocenti
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=430A5D9D.90307@symas.com \
--to=hyc@symas.com \
--cc=ak@suse.de \
--cc=fw@deneb.enyo.de \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox