Re: Performance TODO items

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: "Mikheev, Vadim" <vmikheev(at)SECTORBASE(dot)COM>
Cc: PostgreSQL-development <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Re: Performance TODO items
Date: 2001-07-30 17:58:15
Message-ID: 200107301758.f6UHwFK16411@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> > > > * Order duplicate index entries by tid
> > >
> > > In other words - add tid to index key: very old idea.
> >
> > I was thinking during index creation, it would be nice to
> > order them by tid, but not do lots of work to keep it that way.
>
> I hear this "not do lots of work" so often from you -:)
> Days of simplicity are gone, Bruce. To continue, this project
> requires more and more complex solutions.

Yep. I can dream. :-)

> > > > * Add queue of backends waiting for spinlock
> > >
> > > We shouldn't mix two different approaches for different
> > > kinds of short-time internal locks - in one cases we need in
> > > light lmgr (when we're going to keep lock long enough, eg for IO)
> > > and in another cases we'd better to proceed with POSIX' mutex-es
> > > or semaphores instead of spinlocks. Queueing backends waiting
> > > for spinlock sounds like nonsense - how are you going to protect
> > > such queue? With spinlocks? -:)
> >
> > Yes, I guess so but hopefully we can spin waiting for the queue lock
> > rather than sleep. We could use POSIX spinlocks/semaphores now but we
> > don't because of performance, right?
>
> No. As long as no one proved with test that mutexes are bad for
> performance...
> Funny, such test would require ~ 1 day of work.

Good question. I know the number of function calls to spinlock stuff is
huge. Seems real semaphores may be a big win on multi-cpu boxes.

> > Should we be spinning waiting for spinlock on multi-cpu machines? Is
> > that the answer?
>
> What do you mean?

On a single-cpu machine, if you can't get the spinlock, you should just
sleep and let the process who had it continue. On a multi-cpu machine,
you perhaps should just keep trying, hoping that the process who holds
it finishes soon. I wonder is we should find some kind of test on
postmaster startup that would test to see if we have multiple cpu's and
change from spinlock sleeping to spinlock spin-waiting.

Add to this that fact we can't sleep for less than on clock tick on most
machines, 10ms, and the spinlock stuff needs work.

TODO updated:

* Improve spinlock code, perhaps with OS semaphores, sleeper queue, or
spining to obtain lock on multi-cpu systems

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fernando Nasser 2001-07-30 18:09:41 Re: Revised Patch to allow multiple table locks in "Unison"
Previous Message Mikheev, Vadim 2001-07-30 17:45:30 RE: Performance TODO items