[Serdev] Re: postgres module

Greg Fausak lgfausak at august.net
Mon Jan 26 22:05:24 UTC 2004


Jan,

The delayed open is only for the first use.
After that the database connection stays open, there
is no overhead.

A timer for an inactive close would be good as well,
I have not implemented that.

---greg
>
>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.
>
>_______________________________________________
>Serdev mailing list
>serdev at lists.iptel.org
>http://lists.iptel.org/mailman/listinfo/serdev
>




More information about the Serdev mailing list