473,382 Members | 1,437 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Can XML-RPC performance be improved?

I've got an established client-server application here where there
is now a need to shovel huge amounts of data (structured as lists of
lists) between the two, and the performance bottleneck has become
the amount of time spent parsing XML (it's taking 100% CPU on one or
other end of the connection and accounting for well over 50% of the
total call time, to the extent that it's having a greater impact on
performance than user interaction). And this is using SGMLOP for
parsing -- I dread to think what it would be like with a slower
parser. Anyone (Fredrik?) got any good ideas for tackling this
problem?

--
\S -- si***@chiark.greenend.org.uk -- http://www.chaos.org.uk/~sion/
___ | "Frankly I have no feelings towards penguins one way or the other"
\X/ | -- Arthur C. Clarke
her nu becomež se bera eadward ofdun hlęddre heafdes bęce bump bump bump
Mar 21 '06 #1
15 5515
Sion Arrowsmith wrote:
I've got an established client-server application here where there
is now a need to shovel huge amounts of data (structured as lists of
lists) between the two, and the performance bottleneck has become
the amount of time spent parsing XML (it's taking 100% CPU on one or
other end of the connection and accounting for well over 50% of the
total call time, to the extent that it's having a greater impact on
performance than user interaction). And this is using SGMLOP for
parsing -- I dread to think what it would be like with a slower
parser. Anyone (Fredrik?) got any good ideas for tackling this
problem?


CORBA. Or TCP/IP directly. I know that isn't really the answer you're
looking for - but there is an overhead parsing XML, and that can't go away.
From what I read at SGMLOP's site I doub't that you can get much faster -
because speed comes with sacrificing standard compliancy, which it already
seems to do.

Regards,

Diez
Mar 21 '06 #2
Perhaps there's a hardware solution? Could you run more servers in
parallel? Or have some sort of load distribution system?

(Just some generic server tips, I don't know much about XML-RPC)

-Greg
On 3/21/06, Diez B. Roggisch <de***@nospam.web.de> wrote:
Sion Arrowsmith wrote:
I've got an established client-server application here where there
is now a need to shovel huge amounts of data (structured as lists of
lists) between the two, and the performance bottleneck has become
the amount of time spent parsing XML (it's taking 100% CPU on one or
other end of the connection and accounting for well over 50% of the
total call time, to the extent that it's having a greater impact on
performance than user interaction). And this is using SGMLOP for
parsing -- I dread to think what it would be like with a slower
parser. Anyone (Fredrik?) got any good ideas for tackling this
problem?


CORBA. Or TCP/IP directly. I know that isn't really the answer you're
looking for - but there is an overhead parsing XML, and that can't go away.
From what I read at SGMLOP's site I doub't that you can get much faster -

because speed comes with sacrificing standard compliancy, which it already
seems to do.

Regards,

Diez
--
http://mail.python.org/mailman/listinfo/python-list

--
Gregory Pińero
Chief Innovation Officer
Blended Technologies
(www.blendedtechnologies.com)
Mar 21 '06 #3
Sion Arrowsmith:
I've got an established client-server application here where there
is now a need to shovel huge amounts of data (structured as lists of
lists) between the two, and the performance bottleneck has become
the amount of time spent parsing XML
http://xmlsucks.org/
Anyone got any good ideas for tackling this problem?


cPickle.
http://docs.python.org/lib/module-cPickle.html

--
René Pijlman

Wat wil jij leren? http://www.leren.nl
Mar 21 '06 #4
Sion Arrowsmith wrote:
I've got an established client-server application here where there
is now a need to shovel huge amounts of data (structured as lists of
lists) between the two, and the performance bottleneck has become
the amount of time spent parsing XML (it's taking 100% CPU on one or
other end of the connection and accounting for well over 50% of the
total call time, to the extent that it's having a greater impact on
performance than user interaction). And this is using SGMLOP for
parsing -- I dread to think what it would be like with a slower
parser. Anyone (Fredrik?) got any good ideas for tackling this
problem?


the cElementTree unmarshaller on this page

http://effbot.org/zone/element-iterp...ental-decoding

is a bit faster than the one in xmlrpclib. (to get more performance,
you probably need a library that allows you to register decoders on
the C level.)

</F>

Mar 21 '06 #5
Sion Arrowsmith wrote:
shovel huge amounts of data


That right there basically takes XML-RPC off the table as a viable
solution. No matter how much fine tuning you try large amounts of data
don't bode well using XML-RPC. The other posted alternatives are
certainly worth a shot. From CORBA to cPickle to even a basic TCP
socket connection would be more efficient. I have used XML-RPC for very
small recordset transfers but I wouldn't use it for anything large.

Mar 21 '06 #6

"Diez B. Roggisch" <de***@nospam.web.de> wrote in message
news:48************@uni-berlin.de...
Sion Arrowsmith wrote:
I've got an established client-server application here where there
is now a need to shovel huge amounts of data (structured as lists of
lists) between the two, and the performance bottleneck has become
the amount of time spent parsing XML (it's taking 100% CPU on one or
other end of the connection and accounting for well over 50% of the
total call time, to the extent that it's having a greater impact on
performance than user interaction). And this is using SGMLOP for
parsing -- I dread to think what it would be like with a slower
parser. Anyone (Fredrik?) got any good ideas for tackling this
problem?


CORBA. Or TCP/IP directly.

<snip>

Beware, CORBA marshaling/unmarshaling can be similarly deadly, especially if
you are passing Any's and have to marshal complex type codes. But if you
are just sending arrays of octets, or strings of chars, then CORBA
marshal/unmarshal will be quite fast.

Of course, something will have to convert that array to meaningful data
*somewhere*! You can't really eliminate software complexity, you can only
move it around. (not original, I'm quoting Chris Stone, founder of the OMG.
Also from Chris Stone - "I finally came up with a good definition for
middleware. Middleware is the software nobody wants to pay for.")

-- Paul


Mar 21 '06 #7

Diez> Sion Arrowsmith wrote:
I've got an established client-server application here where there
is now a need to shovel huge amounts of data (structured as lists of
lists) between the two, and the performance bottleneck has become
the amount of time spent parsing XML ...
Diez> CORBA. Or TCP/IP directly. I know that isn't really the answer
Diez> you're looking for - but there is an overhead parsing XML, and
Diez> that can't go away.

Ah, but if both ends of the pipe happen to be running Python, you can
cheat. ;-) Run your list through marshal.dumps() before passing it to
xmlrpclib, then undo the marshalling on the other end.
biglist = ["abc"] * 50
biglist = [biglist] * 50
import xmlrpclib
import marshal
x = xmlrpclib.dumps((biglist,))
len(x) 92331 x.count("<") 10310 y = xmlrpclib.dumps((marshal.dumps(biglist),))
len(y) 20324 y.count("<")

8

If you can swing it, I'd be willing to bet you a beer your XML parsing time
will all but disappear.

If you're not using xmlrpclib with some sort of C helper (like sgmlop), try
that as well. Big difference parsing XML in C and Python.

Skip
Mar 21 '06 #8
gregarican wrote:
Sion Arrowsmith wrote:

shovel huge amounts of data

That right there basically takes XML-RPC off the table as a viable
solution. No matter how much fine tuning you try large amounts of data
don't bode well using XML-RPC. The other posted alternatives are
certainly worth a shot. From CORBA to cPickle to even a basic TCP
socket connection would be more efficient. I have used XML-RPC for very
small recordset transfers but I wouldn't use it for anything large.

<rant>
I am continually surprised that the industry as a whole has become so
enamoured of XML that people persist in using it for tasks it was never
designed nor intended to be used for.
</rant>

I suppose there *was* a good reason for using XML-RPC in the first place?

regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC/Ltd www.holdenweb.com
Love me, love my blog holdenweb.blogspot.com

Mar 21 '06 #9

Steve> I suppose there *was* a good reason for using XML-RPC in the
Steve> first place?

I don't know about the OP, but in my case it was a drop-dead simple
cross-language RPC protocol. At one point Mojam's XML-RPC server talked to
clients written in Python, Perl and Objective-C (via a Java bridge, no
less).

Skip

Mar 21 '06 #10
Skip wrote:
I don't know about the OP, but in my case it was a drop-dead simple
cross-language RPC protocol.


Exactly. RPC implementations. Typically these are a quick "do this with
this" sent from the client, with a brief "okay, I did that, here's the
result" back from the server. Shovelling huge amounts of data using any
XML encapsulation leads to a certain code smell at the very least.

Mar 21 '06 #11
gregarican wrote:
Skip wrote:

I don't know about the OP, but in my case it was a drop-dead simple
cross-language RPC protocol.

Exactly. RPC implementations. Typically these are a quick "do this with
this" sent from the client, with a brief "okay, I did that, here's the
result" back from the server. Shovelling huge amounts of data using any
XML encapsulation leads to a certain code smell at the very least.

Especially when people try to pass large amounts of free text (like
Python scripts) as attribute values ;-)

regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC/Ltd www.holdenweb.com
Love me, love my blog holdenweb.blogspot.com

Mar 21 '06 #12
> Beware, CORBA marshaling/unmarshaling can be similarly deadly, especially if
you are passing Any's and have to marshal complex type codes. But if you
are just sending arrays of octets, or strings of chars, then CORBA
marshal/unmarshal will be quite fast.
Sure, any is no good at all. But I guess having a well-defined struct
makes send corba the data comparably packed and (give or take endianess)
directly in a representation close to what the result will look like. In
contrast to XML, that wraps _everything_ in a plethora of bytes just for
the fun of it...

Of course, something will have to convert that array to meaningful data
*somewhere*! You can't really eliminate software complexity, you can only
move it around. (not original, I'm quoting Chris Stone, founder of the OMG.
Also from Chris Stone - "I finally came up with a good definition for
middleware. Middleware is the software nobody wants to pay for.")


Also true - but you can make the matter of reinterpreting a bunch of
bytes a mere cast (TCP/IP solution) or invoke a few thousand lines of
code called XML-Parser. And on top of _that_ the XMLRPC itself. CORBA is
certainly between these two, but on a scale of 5-20 times faster. Which
might be the difference between a loaded but responsive server and a
self-inflicted DDOS :)

Diez
Mar 21 '06 #13
Sion Arrowsmith wrote:
I've got an established client-server application here where there
is now a need to shovel huge amounts of data (structured as lists of
lists) between the two, and the performance bottleneck has become
the amount of time spent parsing XML


Any chance of replacing the RPC protocol by something else
that is more efficient? If so, and you're in a 100%-python situation,
have a look at Pyro: http://pyro.sourceforge.net

(Pyro basically uses "native" Python pickling as marshaling)

--Irmen
Mar 22 '06 #14
<sk**@pobox.com> wrote:
Diez> Sion Arrowsmith wrote:
>> I've got an established client-server application here where there
>> is now a need to shovel huge amounts of data (structured as lists of
>> lists) between the two, and the performance bottleneck has become
>> the amount of time spent parsing XML ...
Diez> CORBA. Or TCP/IP directly. I know that isn't really the answer
Diez> you're looking for - but there is an overhead parsing XML, and
Diez> that can't go away.
Ah, but if both ends of the pipe happen to be running Python, you can
cheat. ;-) Run your list through marshal.dumps() before passing it to
xmlrpclib, then undo the marshalling on the other end.
[ ... ]
If you can swing it, I'd be willing to bet you a beer your XML parsing time
will all but disappear.


I wouldn't take you up on that bet, because I'd already considered
that as a likely solution, and while I was asking here another member
of the team went away and implemented it for me. Except with cPickle
(as suggested elsewhere in the thread) -- we've got DateTime objects
in there, which marshal chokes on. Initial tests show you'd've
comfortably won your beer: 16s XML parsing down to 0.5s parsing plus
1.5s unpickling.
If you're not using xmlrpclib with some sort of C helper (like sgmlop), try
that as well. Big difference parsing XML in C and Python.


Diez edited out the bit where I said we were using sgmlop and worried
about what it would be like if we weren't 8-)

--
\S -- si***@chiark.greenend.org.uk -- http://www.chaos.org.uk/~sion/
___ | "Frankly I have no feelings towards penguins one way or the other"
\X/ | -- Arthur C. Clarke
her nu becomež se bera eadward ofdun hlęddre heafdes bęce bump bump bump
Mar 23 '06 #15
<sk**@pobox.com> wrote:
Steve> I suppose there *was* a good reason for using XML-RPC in the
Steve> first place?
I don't know about the OP, but in my case it was a drop-dead simple
cross-language RPC protocol.


I am the OP and *I* don't know if there was a good reason for using
XML-RPC in the first place. It's someone else's code, and they're
no longer with the company. I can see it being justifiable at the
time: (a) single developer writing both server and client doesn't
need to think about the implemention of their communication (b) in
the future there may be other clients in other languages (as above)
and (c) up until recently, the volume of data being passed back and
forth wasn't high enough for XML parsing performance to be of much
significance. I've known XML parsing makes XML-RPC suck since, er,
before XML-RPC was invented. (At about the same time that SOAP was
being developed, we developed a prototype component system using
XML for message passing, then threw it away when it was clear that
the XML parsing was a major bottleneck.)

--
\S -- si***@chiark.greenend.org.uk -- http://www.chaos.org.uk/~sion/
___ | "Frankly I have no feelings towards penguins one way or the other"
\X/ | -- Arthur C. Clarke
her nu becomež se bera eadward ofdun hlęddre heafdes bęce bump bump bump
Mar 23 '06 #16

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Phil Powell | last post by:
// PROCESS XML CONTENT INTO DYNAMICALLY-NAMED ARRAYS foreach (array('mime', 'state', 'country') as $val) { $parser = xml_parser_create(); xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);...
8
by: Robert J Egan | last post by:
Hi i'm trying to search a remote website page. The form returns xml information, though the page extension is missing. I retrieve the information and write it to the screen. So far so good -...
0
by: Stylus Studio | last post by:
World's Most Advanced XML Schema Editor Adds Support for IBM AlphaWorks XML Schema Quality Checker to Improve XML Schema Style and Quality BEDFORD, MA -- 09/13/2005 -- Stylus Studio...
5
by: laks | last post by:
Hi I have the following xsl stmt. <xsl:for-each select="JOB_POSTINGS/JOB_POSTING \"> <xsl:sort select="JOB_TITLE" order="ascending"/> This works fine when I use it. But when using multiple...
0
by: jts2077 | last post by:
I am trying to create a large nested XML object using E4X methods. The problem is the, the XML I am trying to create can only have xmlns set at the top 2 element levels. Such as: <store ...
0
by: UncleRic | last post by:
Environment: Mac OS X (10.4.10) on MacBook Pro I'm a Perl Neophyte. I've downloaded the XML::Parser module and am attempting to install it in my working directory (referenced via PERL5LIB env): ...
9
by: Lie | last post by:
Why this generates AttributeError, then not? Python 2.5.2 (r252:60911, Apr 21 2008, 11:17:30) on linux2 Type "help", "copyright", "credits" or "license" for more information. Traceback (most...
10
by: =?Utf-8?B?YzY3NjIyOA==?= | last post by:
Hi all, I had a program and it always works fine and suddenly it gives me the following message when a pass a xml file to our server program: error code: -1072896680 reason: XML document must...
0
by: Jacker | last post by:
Xpress Author for MS Word XML Documents In.vision Research empowers knowledge workers to create complex XML documents in Microsoft Word (2000-2003) with a normal Word experience. Deploy XML...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.