Where do I call closeDB in db.py

On 1/6/07, Christoph Zwerschke <cito@online.de> wrote:
> I m still getting the too many clients error, now my postgresql
> max _connections is 256
> and shared_buffers = 2048
> and this is how pg and dbutils
>  from DBUtils.PooledDB import PooledDB
>     web.config._hasPooling = True

Ok, only now I understand that you are using DBUtils with web.py. You
did not mention it in the beginning. I haven't tried out web.py yet, but
it seems the default configuration is unlimited pool size. You should
change that and set mincached and maxmached parameters, probably in the
web.config.db_parameters (you may have to ask about web.py specifics on
their google group).

Anyway, normally you should not hit that limit unless you are really
handling so much concurrent users, since the pool only grows if
connections are not given back to it. So the real problem may be that
you are not returning your used connections back to the pool. You do
that by simply calling the close method of your connection immediately
after usage (see http://www.w4py.org/DBUtils/Docs/UsersGuide.html#id2).
Also, (if possible) avoid opening database connections for anonymous
users, and use the database only once they logged in, in order to limit
the number of concurrent database connections.

-- Christoph

Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net 's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
Webware-discuss mailing list