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

From Ken Hirsch
Subject Re: Pre-forking backend
Date
Msg-id 008001c14925$3eeb2520$87863dd0@hppav
Whole thread Raw
In response to Re: Pre-forking backend  (Bruce Momjian <pgman@candle.pha.pa.us>)
Responses Re: Pre-forking backend  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-hackers
Bruce Momjian wrote:
> Tom Lane wrote:
> > Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > > How hard would it be to pre-fork an extra backend
> >
> > How are you going to pass the connection socket to an already-forked
> > child process?  AFAIK there's no remotely portable way ...
>
> No idea but it seemed like a nice optimization if we could do it.

What can be done is to have the parent process open and listen() on the
socket, then have each child do an accept() on the socket.   That way you
don't have to pass the socket. The function of the parent process would then
be only to decide when to start new children.

On some operating systems, only one child at a time can accept() on the
socket.  On these, you have to lock around the call to accept().







pgsql-hackers by date:

Previous
From: Vince Vielhaber
Date:
Subject: Re: Preparation for Beta
Next
From: Bruce Momjian
Date:
Subject: Re: Pre-forking backend