[Serdev] Re: postgres module
Jan Janak
jan at iptel.org
Mon Jan 26 21:58:56 UTC 2004
On 26-01 15:37, Greg Fausak wrote:
> I hacked dbase.c in the postgres modules to:
>
> 1) Skip the connect_db() when doing db_init()
> 2) Call connect_db() in any operation that tries to use the
> database, but the database is currently not open.
>
> Using this technique has cut the number of database connections
> to two. Maybe a combination of both techniques is in order?
OK but this is quite inefficient. Imagine what happens when you open a
connection to the database:
- Establish a TCP connection (3-way handshake)
- Authenticate user (exchange of credencials)
- Authorize user
- Start thread/process on the server
- select database and verify permissions
Add TLS/SSL handshake (which can take several hundreds of ms) when
encryption is used.
And all this is done several times per request (digest authentication,
accounting, domain verification, group checking).
Or maybe there is a timer which closes connections on inactivity
? In this case it could be useful if you really want to keep the
number of connections as low as possible.
Jan.
More information about the Serdev
mailing list