Re: Pre-forking backend - Mailing list pgsql-hackers

From Lincoln Yeoh
Subject Re: Pre-forking backend
Date
Msg-id 3.0.5.32.20011015103251.0086d100@192.228.128.13
Whole thread Raw
In response to Re: Pre-forking backend  (Bruce Momjian <pgman@candle.pha.pa.us>)
Responses Re: Pre-forking backend
Re: Pre-forking backend
List 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.




pgsql-hackers by date:

Previous
From: Tatsuo Ishii
Date:
Subject: Re: [PATCHES] Unicode combining characters
Next
From: "Christopher Kings-Lynne"
Date:
Subject: Re: How do I get the current time in seconds in the unix epoch?