Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> One possible way to do make an improvement in this area would be to
> move the responsibility for accepting connections out of the
> postmaster. Instead, you'd have a group of children that would all
> call accept() on the socket, and the OS would arbitrarily pick one to
> receive each new incoming connection. The postmaster would just be
> responsible for making sure that there were enough children hanging
> around. You could in fact make this change without doing anything
> else, in which case it wouldn't save any work but would possibly
> reduce connection latency a bit since more of the work could be done
> before the connection actually arrived.
This seems like potentially a good idea independent of anything else,
just to reduce connection latency: fork() (not to mention exec() on
Windows) now happens before not after receipt of the connection request.
However, I see a couple of stumbling blocks:
1. Does accept() work that way everywhere (Windows, I'm looking at you)
2. What do you do when max_connections is exceeded, and you don't have
anybody at all listening on the socket? Right now we are at least able
to send back an error message explaining the problem.
Another issue that would require some thought is what algorithm the
postmaster uses for deciding to spawn new children. But that doesn't
sound like a potential showstopper.
regards, tom lane
In response to
pgsql-hackers by date
|Next:||From: Tom Lane||Date: 2010-12-06 17:41:55|
|Subject: Re: pg_execute_from_file review |
|Previous:||From: Tom Lane||Date: 2010-12-06 17:31:54|
|Subject: Re: WIP patch for parallel pg_dump |