Re: [GENERAL] fork() bad

From: Gerard Saraber <gsaraber(at)glasscity(dot)net>
To: pgsql-general(at)postgreSQL(dot)org
Subject: Re: [GENERAL] fork() bad
Date: 1999-03-22 18:03:35
Message-ID: 36F685F7.CEF52B06@glasscity.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello,

Richi Plana wrote:
>
> Hi,
>
[ previous discussion snipped ]

>
> Looks like the general consensus is fork()ing is a bad thing where
> PostgreSQL is concerned. So what I did was refrained from opening a
> connection to the backend until AFTER the process fork()ed.
>
> As some of you may know, I'm hacking Ascend RADIUS 2.01 to look up a
> PostgreSQL database for authentication and log to PG for accounting.
> Normally, RADIUS fork()s once for Accounting and fork()s for each
> Authentication request. That's a lot of fork()ing and establishing
> connections to the backend. It's slow, but it's better than junking
> whatever code I've written so far.
>
> If anyone can give a better suggestion, I'm all ears. Also, if anyone
> wants the code when it's done, try asking. ;^)
>

Would it be possible to create a "connection pool" sort of have an array
of connections go pgsql, and mark one of them as "in use" right before
you fork?
You may have to stick the "in use" marks in shared memory, so that after
the fork-ed process is done with the pgsql connection it marks it as
"free" again, so it can be re-used for a next process.
I hope I'm making some sense :)

Regards,
Gerard Saraber
gsaraber(at)glasscity(dot)net

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Charles Hornberger 1999-03-22 19:41:01 Extensive PostgreSQL queries in PHP scripts causing browser error?
Previous Message Richi Plana 1999-03-22 16:29:23 Re: [GENERAL] fork() bad