axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jarek Gawor" <ga...@mcs.anl.gov>
Subject RE: Axis memory usage and performance
Date Sun, 14 Nov 2004 07:07:45 GMT


> -----Original Message-----
> From: Archit Shah [mailto:archit.shah@alum.mit.edu] 
> Sent: Friday, November 12, 2004 3:27 PM
> To: axis-dev@ws.apache.org
> Subject: Axis memory usage and performance
> 
> 
> Inspired by jira issue AXIS-1391, I have been investigating 
> server side 
> performance and memory consumption by looking at the memory 
> allocations 
> (using the JVM's -Xrunhprof:heap=sites) and using the SOAP benchmark 
> from Alek (http://www.extreme.indiana.edu/xgws/soap_bench/) and 
> SimpleAxisServer. The most illustrative test involved 10 calls to a 
> simple SOAP method:
> 
> public int receiveDoubles(double[] input) throws Exception {
>      return input.length;
> }
> 
> with an input array of length 5000. Memory profiling seems to 
> show that 
> the data is copied repeatedly during deserialization and that 
> there is 
> a lot of per-array element work (about 40 objects allocated). 
> Reducing 
> this work could help boost performance and reduce memory footprint. 
> Here is what I think is happening:
> 
> Data starts in char[] buffer.
> 1) sent to the SAX2EventRecorder where it is converted to a string 
> (line 91)
> 2) during replay it is converted back to char[] in order to use the 
> ContentHandler API
> 3) the replay client (SimpleDeserializer, I think) copies the data to 
> its internal CharArrayWriter
> 4) SimpleDeserializer.onEndElement converts its CharArrayWriter to a 
> String

I updated the SAX2EventRecorder not to convert to String and then back to
char[]. The input char[] still needs to be cloned, but that's one less clone
then before.

> That covers 4 copies of each piece of data that needs 
> deserialization. 
> In addition, I see significant allocations from 
> SOAPHander.onEndElement 
> (lines 114 and 118). SOAPHandler.onEndElement calls 
> addTextNode, first 
> converting to String from a CharArrayWriter. addTextNode ends up 
> calling into crimson which converts the string back to a char[]. I 
> believe this happens before the replay. I am not sure why this is 
> necessary, as the data is stored in the event recorder.

I'm not sure why addTextNode is called in the first place either. I ran all
axis tests and tests in our software and saw no problems with that code
removed.

> In addition to the input data being copied, there are other 
> sources of 
> per-array element allocations:
> 
> - SimpleDeserializer initialization (1 allocated per array element)
> 
> - NSStack (1 call to cloneFrame per array element)
> 
> - NodeImpl.initializeChildren (3 array list allocations per array 
> element)
> 
> - DeserializerImpl.addChildDeserializer (1 call per array element, 
> allocating 1 CallbackTarget and 1 vector)
> 
> Here is the the output from the allocation profiler showing the per 
> array element allocations (the full output is available on jira as an 
> attachment to issue 1391 (it will be once I can successfully upload, 
> something seems to be broken right now):

Where is that attachment? I can't find it with that bug.

Jarek




Mime
View raw message