Re: PostgreSQL pre-fork speedup

From: "scott(dot)marlowe" <scott(dot)marlowe(at)ihs(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: sdv mailer <sdvmailer(at)yahoo(dot)com>, Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, Rod Taylor <pg(at)rbt(dot)ca>, Tatsuo Ishii <t-ishii(at)sra(dot)co(dot)jp>, <steve(at)blighty(dot)com>, PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: PostgreSQL pre-fork speedup
Date: 2004-05-06 19:30:59
Message-ID: Pine.LNX.4.33.0405061327430.5592-100000@css120.ihs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, 6 May 2004, Tom Lane wrote:

> sdv mailer <sdvmailer(at)yahoo(dot)com> writes:
> > The point is pre-forking can *potentially* speed up
> > connections by 5x as shown in this simplistic
> > non-conclusive benchmark.
>
> I think this "benchmark" proves no such thing.
>
> The thing that pgpool is doing is not preforking connections at all, but
> re-using prior connections. The important difference is that you are
> using a "hot" backend that has already loaded a full working set of
> relcache and syscache entries --- and not just any old entries, but
> exactly those needed to process your query. (The fact that the pgbench
> test uses only a very limited set of queries probably causes this test
> to overstate the effect compared to more realistic workloads.)
>
> The profiling that I've done of backend startup shows that cache
> initialization accounts for the bulk of the startup delay. And IIRC,
> I was just measuring the time needed to be ready to accept the first
> query, not the additional effort to fetch query-specific cache entries.
> So having a hot backend would make a significant difference, but merely
> avoiding the fork wouldn't necessarily.

Wouldn't the db selection / authentication be more / as expensive as
buffer creation? Even in trust mode the backend still has to
"authenticate" it just doesn't have to do as much to do that as with
passwords. I'd expect that to be a big chunk of time too.

It appears the best place to fix this "problem" (not a problem with
postgresql, but an engineering problem in an abstract sense) is with
pooling, and once the flushing etc... in tatsuo's code is fixed up to be
zippy, pgpool would be THE answer for such issues.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Stark 2004-05-06 20:33:34 Re: More Hashing questions
Previous Message James Robinson 2004-05-06 19:06:56 Re: PostgreSQL pre-fork speedup