Probably not related to your issue, but wouldn't you want to leave the connection (or connection pool) open between transactions, and just create/destroy cursors in the awake/sleep cycle?
-Jacob On Wed, 23 Feb 2005 23:15:43 -0800, jose <[EMAIL PROTECTED]> wrote: > Dear webware community, > > I'm perplexed, I have been playing around with XMLRPC as a way to connect to > a database and deliver content. Please see the code below:(one is a > XMLRPCServlet and the second is a regular servlet) > > The is issue is that the XMLRPC servlet is about 8 times slower then the > regular servlet. This doesn't make any sense to me. If I kill the sleep > method, and not close the db connection, then it is really fast, but somehow > that does not feel right. I don't seem to be taking much of a hit by > getting a new connection every time with the regular servlet, so why should > it be so with the xmlrpc servlet? Am I doing something fundamentally wrong > in the xmlrpc? > > Any help would be great, and thanks in advance > > Jose > > ===================================================================== > server.py: > ===================================================================== > from WebKit.XMLRPCServlet import XMLRPCServlet as XS > import psycopg as pg > > class server(XS): > > def __init__(self): > XS.__init__(self) > self.db = None > > def awake(self, trans): > XS.awake(self, trans) > self.db = pg.connect(user = 'postgres', database='phonebook') > def sleep(self, trans): > XS.sleep(self, trans) > if self.db: > self.db.close() > def cur(self): > return self.db.cursor() > > def exposedMethods(self): > return [ > 'echo', > 'listPeople' > ] > > def echo(self, what='you need to enter something'): > return what > > def listPeople(self): > sql = ''' > select > fname, > lname > from people > ''' > cur = self.cur() > cur.execute(sql) > people = cur.fetchall() > return people > ============================================================ > test.py > ============================================================ > from WebKit.Page import Page > import psycopg as pg > > class test(Page): > > def __init__(self): > Page.__init__(self) > self.db = None > > def awake(self, trans): > Page.awake(self, trans) > self.db = pg.connect(user = 'postgres', database='phonebook') > > def sleep(self, trans): > Page.sleep(self, trans) > if self.db: > self.db.close() > def cur(self): > return self.db.cursor() > > def writeContent(self): > sql = ''' > select > fname, > lname > from people > ''' > cur = self.cur() > cur.execute(sql) > people = cur.dictfetchall() > self.write(people) > ============================================================================ > ========= > > ------------------------------------------------------- > SF email is sponsored by - The IT Product Guide > Read honest & candid reviews on hundreds of IT Products from real users. > Discover which products truly live up to the hype. Start reading now. > http://ads.osdn.com/?ad_ide95&alloc_id396&opclick > _______________________________________________ > Webware-discuss mailing list > Webware-discuss@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/webware-discuss > ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_ide95&alloc_id396&op=click _______________________________________________ Webware-discuss mailing list Webware-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/webware-discuss