Re: [cx-oracle-users] Session Pooling
Brought to you by:
atuining
From: Anthony T. <ant...@gm...> - 2005-08-02 13:41:06
|
On 8/1/05, Orr, Steve <so...@ri...> wrote: > So long without answers? Are my questions too hard? :-) No. Just a long weekend here in Canada. :-) > I was wrong about the SessionPool.timeout attribute. It works just fine. > I can configure the number of processes which Apache spawns and even > though each process establishes a reusable pool of database connections > they level off with inactivity and scale up when needed. Pooling > connections with cx_Oracle/Apache/mod_python serves up data driven web > pages really FAST! Sounds good. > I'm still wondering about the ramifications of adding connections with > different credentials than what the session pool was created with. See earlier e-mail. > I'd also like to get some feedback on caching cursors. It seems like I > saw some code for that in the cx utilities or whatever. I'm just > wondering how much coding effort is required and what's the benefit? See earlier e-mail. > Steve Orr >=20 >=20 > -----Original Message----- > From: cx-...@li... > [mailto:cx-...@li...] On Behalf Of Orr, > Steve > Sent: Monday, August 01, 2005 11:28 AM > To: cx-...@li... > Subject: [cx-oracle-users] Session Pooling >=20 > I'm looking to use session pooling for performance (Apache 2.0, > mod_python, Quixote 2.0, cx_Oracle 4.x Oracle9). Here's some code for > reference: > import cx_Oracle > class dbconnect(cx_Oracle.Connection): > def __init__(self, user=3DNone, password=3DNone, dsn=3DNone, pool=3DN= one): > cx_Oracle.Connection.__init__(self, user=3Duser, > password=3Dpassword, > dsn=3Ddsn, pool=3Dpool) > self.pool =3D pool > def close(self): > self.pool.release(self) > class dbfun(object): > def __init__(self): > self.pool =3D cx_Oracle.SessionPool('user', 'pw', 'local', 1, 8, > 1) > self.pool.timeout =3D 30 > def connect(self, user, password, dsn): > conn =3D dbconnect(user=3Duser, password=3Dpassword, > dsn=3Ddsn, pool=3Dself.pool) > return conn >=20 > Basically I subclassed the cx_Oracle connection object to over-ride the > close function to release a connection to the pool instead of closing > it. >=20 > Observations and Questions: > Setting the timeout attribute doesn't seem to change anything, no > connections are returned to the pool after 30 seconds. Is this a bug or > am I doing something wrong? >=20 > If I exceed the session limit from Python it just hangs... Shouldn't > cx_Oracle.Connection return an exception? Do I really HAVE to compare > pool.busy and pool.opened in my code and raise my own exception? >=20 > I found that if I kill a session from SQL*Plus it does not become > available to the pool. Well okay. >=20 > I found that when connecting through my dbfun class I could connect with > a different user/password than was established in the pool. What are the > ramifications of this? If I want to pool connections from different > users do I need to create distinct pools for each user ID? >=20 > Are there any other suggestions or sample code on how to implement > connection pooling? Has anyone cached cursors and is it worth it? >=20 > TIA, > Steve Orr >=20 >=20 > ------------------------------------------------------- > SF.Net email is sponsored by: Discover Easy Linux Migration Strategies > from IBM. Find simple to follow Roadmaps, straightforward articles, > informative Webcasts and more! Get everything you need to get up to > speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id=16492&op=3Dick > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users >=20 >=20 >=20 > ------------------------------------------------------- > SF.Net email is sponsored by: Discover Easy Linux Migration Strategies > from IBM. Find simple to follow Roadmaps, straightforward articles, > informative Webcasts and more! Get everything you need to get up to > speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id=16492&opclick > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > |