durusmail: quixote-users: reusing connections, SCGI and PostgreSQL max_connection limit
reusing connections, SCGI and PostgreSQL max_connection limit
2005-01-24
reusing connections, SCGI and PostgreSQL max_connection limit
Titus Brown
2005-01-24
-> I guess the  usual way of reusing connections is the one from the wiki
-> (http://www.quixote.ca/qx/ReusingConnections). When used with SCGI it
-> leads to multiple instances of the connection, one for each SCGI
-> process. But even on a low traffic website, if it has back-end as a
-> separate application, and some central user database where all
-> websites need access to, it leads to about 10 connection that every
-> website creates...
-> Is it just the way it is, and I should ajust max_connection variable
-> of PostgreSQL (32 by default) and keep enjoying Quixote ;-) ?  Or
-> maybe it is possible to create some inter-process database pool (I
-> hope it's a right name) that will use connections more efficiently?

Most of those connections won't get used & postgresql can easily handle
a lot of connections; in conjunction with my simple Linda tuple space
implementation, the Quixote-based app I run has about 30 connections per
app instance.  Wasteful but not worth optimizing so far ;).

One thing to watch out for is that Postgres works on a process model,
so each connection means a new backend... you might need extra swap
space.

Incidentally, I use psycopg, which may lead to even more connection
"waste" as it maintains a pool of connections itself.

cheers,
--titus

reply