Fri, 30 Dec 2005
RPC in Python - a comparison of Pyro and xmlrpc
I have been dabbling in rpc on python, after removing a home brew rpc system using pickle and unix domain sockets and replacing it with something more network aware. xmlrpc is cool, but seemed to be a bit slow. Poking around I found Pyro, which looked good and also passed my test of a server taking just a few lines of code to create.So I made some test code using some ultra simplified versions of my rpc class methods that can work with either RPC scheme depending on the command line args. The results of timing the below code is that for this test, Pyro is 18 times faster. There are of course the various caveats about Pyro's security, and the standards compliance and interoperability of xmlrpc, so its also a case of different horses for different courses.
Also maybe handy as a simple example of xmlrpc and Pyro rpc under Python:
server code
import Pyro.core
import SimpleXMLRPCServer
import os, sys
class rpctest(Pyro.core.ObjBase):
def __init__(self):
Pyro.core.ObjBase.__init__(self)
# get a file.. simple version
def getfile(self,file):
filedata = open(file,"r").read()
return filedata
def listdir(self,dirname):
listdirresults = os.listdir(dirname)
return listdirresults
if sys.argv[1] == "xmlrpc":
server = SimpleXMLRPCServer.SimpleXMLRPCServer(("",
8000),logRequests=False)
server.register_instance(rpctest())
print "running in xmlrpc mode"
server.serve_forever()
else:
Pyro.core.initServer()
daemon=Pyro.core.Daemon()
uri=daemon.connect(rpctest(),"rpctest")
print "The daemon runs on port:",daemon.port
print "The object's uri is:",uri
daemon.requestLoop()
client benchmark code
import Pyro.core
import xmlrpclib, os, sys
if sys.argv[1] == "xmlrpc":
rpctest = xmlrpclib.Server("http://192.168.1.1:8000")
else:
rpctest =
Pyro.core.getProxyForURI("PYROLOC://192.168.1.1:7766/rpctest")
for i in range(1000):
print len(rpctest.getfile("/etc/passwd"))
print len(rpctest.getfile("/etc/group"))
print len(rpctest.listdir("/usr/bin"))
Posted at: 23:22 | category: /nerdy | # | 0 comments
Tue, 27 Dec 2005
SkypeOut Sounds Terrible
I have been attempting to use SkypeOut to try and call Nan in Thailand. The sound quality is shockingly bad, and I know the problem occurs on the skype side, not (mostly) the Thai mobile phone network.A pity as skype itself (i.e. skype to skype communication) has very good sound quality.
Posted at: 01:17 | category: /rants | # | 0 comments
Sun, 18 Dec 2005
I Miss Nan
For some reason over this Stolan Pagan Festival period I am reminded of a track I wrote ages ago, I miss Nan.Posted at: 13:06 | category: / | # | 0 comments
Wed, 14 Dec 2005
Rally Against Racism! Sunday 18th
(sent to me via email, lets counter the negative propaganda)It's time for ALL Australians to Unite Against Racism!
The Unite Against Racism Rally
WHEN: Sunday 18th December 2005
TIME: 1pm
WHERE: Town Hall Square
After a marathon meeting at UTS last night, NUS (National Union of Students) and other associated community and cultural groups think it's time that the countless thousands of Sydney-siders who DID NOT like what they saw last weekend in Cronulla took to the streets to make their voice heard.
We need to send the strongest possible message to the rest of Australia and to the rest of the world that those 5000 people who rioted at Cronulla do not speak for us.
As such we need to quadruple their number, rain hail or shine!
Spam this out to everyone you know! Lets get down there and show the world that we ain't a nation of redneck dic*heads.
Posted at: 14:51 | category: /rants | # | 0 comments
