[Patches] [ python-Patches-517256 ] poor performance in xmlrpc response

noreply@sourceforge.net noreply@sourceforge.net
Sun, 17 Mar 2002 05:30:30 -0800


Patches item #517256, was opened at 2002-02-14 00:48
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=517256&group_id=5470

Category: Library (Lib)
Group: Python 2.1.2
Status: Open
Resolution: Accepted
Priority: 5
Submitted By: James Rucker (jamesrucker)
Assigned to: Fredrik Lundh (effbot)
Summary: poor performance in xmlrpc response

Initial Comment:
xmlrpclib.Transport.parse_response() (called from 
xmlrpclib.Transport.request()) is exhibiting poor 
performance - approx. 10x slower than expected.

I investigated based on using a simple app that sent a 
msg to a server, where all the server did was return 
the message back to the caller.  From profiling, it 
became clear that the return trip was taken 10x the 
time consumed by the client->server trip, and that the 
time was spent getting things across the wire.

parse_response() reads from a file object created via 
socket.makefile(), and as a result exhibits 
performance that is about an order of magnitude worse 
than what it would be if socket.recv() were used on 
the socket.  The patch provided uses socket.recv() 
when possible, to improve performance.

The patch provided is against revision 1.15.  Its use 
provides performance for the return trip that is more 
or less equivalent to that of the forward trip.


----------------------------------------------------------------------

>Comment By: Fredrik Lundh (effbot)
Date: 2002-03-17 14:30

Message:
Logged In: YES 
user_id=38376

James, what platform(s) did you use?

I'm not sure changing the parse_response() interface is
a good idea, but if this is a Windows-only problem, there
may be a slightly cleaner way to get the same end result.

</F>

----------------------------------------------------------------------

Comment By: Guido van Rossum (gvanrossum)
Date: 2002-03-01 17:14

Message:
Logged In: YES 
user_id=6380

My guess makefile() isn't buffering properly. This has been
a long-standing problem on Windows; I'm not sure if it's an
issue on Unix.

----------------------------------------------------------------------

Comment By: Fredrik Lundh (effbot)
Date: 2002-03-01 15:34

Message:
Logged In: YES 
user_id=38376

looks fine to me.  I'll merge it with SLAB changes,
and will check it into the 2.3 codebase asap.

(we probably should try to figure out why makefile
causes a 10x slowdown too -- xmlrpclib isn't exactly
the only client library reading from a buffered
socket)

</F>

----------------------------------------------------------------------

Comment By: Guido van Rossum (gvanrossum)
Date: 2002-03-01 00:23

Message:
Logged In: YES 
user_id=6380

Fredrik, does this look OK to you?


----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=517256&group_id=5470