Re: Pre-forking backend

From: Lincoln Yeoh <lyeoh(at)pop(dot)jaring(dot)my>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Doug McNaught <doug(at)wireboard(dot)com>, Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>, sean-pgsql-hackers(at)chittenden(dot)org, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Pre-forking backend
Date: 2001-10-15 02:32:51
Message-ID: 3.0.5.32.20011015103251.0086d100@192.228.128.13
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

How would authentication and access control be done with a preforking
backend? I personally find a preforking backend desirable, but that's just me.

But if people really want preforking how about not doing it in the backend.

Create a small program that makes a few connections to postgresql, does
some initialization, preconnects to various DBs (or maybe limited to one DB
specified on startup), and listens on one port/socket. It might not even
prefork, just cache connections so first connection is slow, subsequent
ones are cached along with the user-pass for faster authentication.

Then your apps can connect to that small program, authenticate, and get the
relevant connection. Call it a "Listener" if you want ;).

It does mean double the number of processes. But if done decently it is
likely to mean two less complex and less buggy processes, compared to one
more complex process.

Would the performance be that much lower using this method? There are other
configurations possible with this approach e.g.:

app--unixsocket--"listener"--SSL--backend on another host.

This configuration should reduce the TCP and SSL connection set up times
over a network.

Could have different types of preforkers. Then if a certain mode gets very
popular and performance is insufficient then it could be appropriate to
move that mode to the backend.

Cheerio,
Link.

At 03:55 PM 13-10-2001 -0400, Bruce Momjian wrote:
>
>I realize this is all pie-in-the-sky but I think we need some connection
>pooling capability in the backend someday. We are fine with Apache and
>PHP becuase they can pool themselves but at some point we have too many
>clients reinventing the wheel rather than having our backend do it.
>
>Also, this relates to pre-forking backends and does not related to
>re-using backends, which is another nice feature we should have someday.
>
>> > Added to TODO:
>>
>> I haven't seen a consensus yet.
>
>True. I can remove it or improve it. It is actually:
>
>* Have pre-forked backend pre-connect to last requested database or pass
> file descriptor to backend pre-forked for matching database
>
>which mentions passing file descriptors to backends, which we have
>discussed and should be recorded for posterity.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Christopher Kings-Lynne 2001-10-15 02:42:00 Re: How do I get the current time in seconds in the unix epoch?
Previous Message Tatsuo Ishii 2001-10-15 01:26:19 Re: [PATCHES] Unicode combining characters