Ok I've got an update, and again I really don't understand why this should be the case but it almost renders my last question mute. Apparently the time lag is only only really seen if I test on the same computer which is running the xmlrpc server. If I run the server on one computer and test on an other no significant time lag. Like I said I really don't understand why that should be the case, but I guess as long as it works.
Jose > -------- Original Message -------- > Subject: [Webware-discuss] Why is this xmlrpc so slow? > From: "jose" <[EMAIL PROTECTED]> > Date: Wed, February 23, 2005 11:15 pm > To: webware-discuss@lists.sourceforge.net > > 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&op=click > _______________________________________________ > 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