Re: libpq enhancement for multi-process application
От | Sébastien Bonnet |
---|---|
Тема | Re: libpq enhancement for multi-process application |
Дата | |
Msg-id | 3A3F8B92.124E4E3F@free.fr обсуждение исходный текст |
Ответ на | Re: libpq enhancement for multi-process application (Daniele Orlandi <daniele@orlandi.com>) |
Список | pgsql-hackers |
> Uhm... I always thought that sharing the same socket between > processes is wrong. Well, I've never thought about it before this problem, but it definitely appears to me like something not to do. Sharing remote object doesn't sound right :-( > My multi-process daemon works like apache with a pool of processes > everyone with its own connection to the DB. The connection is only > opened AFTER the fork and remains open as long as the process lives just > to avoid a new connection for each accept. When you can do it this way, that's nice'n'easy. In my case, I have to have a connection before the fork, and keep it after in both parent and child, eventhough it will be closed a few seconds later in the child. So, for now on, the only-almost-clean-solution is to free the pgconn structure in the child and reconnect when needed. This way, the parent process keeps its own connexion. No other process is using it. Sounds safe, but kinda "do-it-yourself" :-( -- Sébastien Bonnet bonseb@free.fr http://bonseb.free.fr/
В списке pgsql-hackers по дате отправления: