axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anand Natrajan <a...@cs.virginia.edu>
Subject Re: Sending big byte arrays
Date Wed, 06 Oct 2004 14:13:00 GMT
Andrea,

Absolutely correct analysis. In general, the big overheads with web services
are:
- serialisation of the request on the client side
- parsing the XML on the server side
- deserialisation of the request on the server side
and the whole thing repeated symmetrically for the response.

By sending large byte arrays you are increasing the time required to parse
the XML and subsequently deserialise.

I have had a similar situation before, and the solutions are the usual:
- if possible, send as an attachment. Doing so removes the data from the XML
  parsing process, thus reducing the time to parse the request/response.
- you could send it as a String, but this would also require changing the
  caller. Besides, all you'd be saving is the base64 decoding time, not the
  parsing time.

Given your tight constraints, you may want to explore an out-of-band way to
send the file. In other words, the caller could give you the location of the
file instead of the contents within the request. Your server would then get
the file using mechanisms other than web services. It's not pretty, but it
may work.

Another option is to compress the file and send the compressed file as a
byte array. You're now adding time to uncompress on the other side, but that
may be faster than parsing gigantic XML.

Good luck!

Anand

On Wed, 6 Oct 2004, Andrea Vaccaro wrote:

: Hello,
: my web service receives a byte array parameter that sometime can be very la=
: rge (>4mb).
: I know that it should be better to send it as an attachment to the soap env=
: elope but the caller is not under my control and I can't modify its code.
: Every call takes quite a lot time and profiling my server I noticed that ne=
: arly the 87% of the total time to process a request is spent inside Axis (o=
: rg.apache.axis.SOAPPart.getAsSOAPEnvelope(), org.apache.axis.message.RPCEle=
: ment.getParams()) and the remaining is spent executing my remote method.
: Is this overhead caused by sending the byte array as a parameter instead of=
:  attachment?
: Are there other solutions to gain better performance?
:
: Thanks in advance,
: Andrea Vaccaro

Mime
View raw message