I've thought if that as well. I am pretty new to using postgres as my main database, most of my experience has been with mysql, and at least with mysql I would run into problems if I didn't explicitly close the connection, leaving it open would eventually crash the server. So I guess what I need to know, is this less of an issue with postgres? Jose
> -------- Original Message -------- > Subject: Re: [Webware-discuss] Why is this xmlrpc so slow? > From: "jacob martinson" <[EMAIL PROTECTED]> > Date: Thu, February 24, 2005 11:20 am > To: "jose" <[EMAIL PROTECTED]> > Cc: "webware-discuss" <webware-discuss@lists.sourceforge.net> > > 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_id"396&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_id=6595&alloc_id=14396&op=click _______________________________________________ Webware-discuss mailing list Webware-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/webware-discuss