Newbie to XML-RPC: looking for advice

Fredrik Lundh fredrik at
Sat Jan 14 09:31:13 CET 2006

David Hirschfield wrote:

> All the above works fine...but I'm finding the following: while the
> actual creation and pickling of the objects only takes a millisecond or
> so, the actual time before the client call completes is a third of a
> second or more.
> So where's the slowdown? It doesn't appear to be in the
> pickling/unpickling or object creation, so it has to be in xmlrpc
> itself...

> but what can I do to improve that? It looks like xmlrpclib uses
> xml.parsers.expat if it's available, but are there faster xml libs?

yes, but if you're sending a single binary object, I doubt the parser
has much to do with it.

to determine if it's an xmlrpclib problem or a network transport problem,
try benchmarking xmlrpclib.dumps and loads calls.  timing first

    request = xmlrpclib.dumps(data, methodname="method")
    # where data is xmlrpclib.Binary object you're using

and then

    request = xmlrpclib.dumps(data, methodname="method")
    data, methodname = xmlrpclib.loads(request)

and comparing this to the full roundtrip time should give you an idea of
where the time is spent.

> On the other hand, maybe the slowdown is in twisted.web.xmlrpc? What
> does that module use to do its work? Is it using xmlrpclib underneath?

figure out if you're actually using the tool you're benchmarking might
be a good idea too, of course.


More information about the Python-list mailing list