Massimo, I think there's an inherent scalability issue in any application that uses per-user database connections. My application is an internal application that will serve only a handful of users, so I’m not too concerned with how it will scale. We are more concerned with pushing access control up to the database level, rather than the application level.
Mariano, Thanks for pointing me to pgpool/pgbouncer. I think I might be able to use one of them to do what I want. Regards, Josh On Sep 27, 8:52 pm, Mariano Reingart <[email protected]> wrote: > If using PostgreSQL, take a look at pgpool or pgbouncer, they will do > some of the things you're expecting, without modifing a single line of > web2py (keep pool_size=1). > > Regards > > Mariano Reingarthttp://www.sistemasagiles.com.arhttp://reingart.blogspot.com > > On Mon, Sep 27, 2010 at 9:48 PM, mdipierro <[email protected]> wrote: > > I would not know how to do this. If you have a lot of users (say 1000) > > how do you know when to close a connection? Do you keep all of them > > open? > > > On Sep 27, 3:25 pm, Josh J <[email protected]> wrote: > >> Most applications connect to the database with one set of credentials, > >> regardless of the user accessing the pages. The current pooling model > >> works very well in this situation. > > >> My application must implement per-user connections to the database, > >> where each user will have their own credentials for the database. > > >> It is simple enough to have web2py to establish a connection on each > >> page load for the users, the difficulty lies with leaving persistent > >> connections open between page loads. The simplest way I have found to > >> do this is by making a SQLDB with pool_size=1 for each user. The > >> problem with this method is that the users connection will stay open > >> after they logout. > > >> I know it's possible to manage the connection pool by manipulating > >> SQLDB._connection_pools externally from my app (say in > >> auth.settings.logout_onlogout), however I would prefer to do something > >> that I know won't break with future updates. > > >> So, community, I ask you, how should I be implementing per-user > >> persistent database connections with web2py? > >

