[ http://issues.apache.org/jira/browse/AXIS-1771?page=comments#action_57830 ] Venkat Reddy commented on AXIS-1771: ------------------------------------
Peter, Here are more observations from me. 1. The tree depth reported by the MemoryTestClient is slightly incorrect. createTree(5,3) actually constructs a tree of 6 levels with 3 children at each level. 2. Since the treesize reported is the memory footprint of the binary data, when we convert it to SOAP message, I'm not sure how many times the size will increase. Axis is taking about 10-12 times (with multiref=false), which I think is not bad. 3. When multi-ref is true, however, we might need some fixing, because of the following - 3.1 The number of elements in the generated SOAPMessage is 4 times of that when multi-ref is false. For example, a (2,7) tree will have 400 elements (343+49+7+1) with no multiref, and the same will have 1600 elements with multi-ref is true. Can't say this is an issue, but it will surely increase memory consumption. 3.2 The recursion I have reported yesterday happens only when multiref is true. The recursion call depth is about 2*d + 3 where d is real depth of tree. So, createTree (5,3) results in recursive calls with depth of 15 (because d is actually 6). This may be linked to the observation 3.1. 3.3 Also attached is a snapshot of recursive calls as an image (recursion.png), and SOAPMessages generated with tree of (2,7). So i think we may have some fixing to do only when multi-ref'ing is true. May be i'm wrong, becuase i really don't know a thing about multi-ref'ing code, except through these test results :) Venkat > Excessive Memory Use During Serialization/Deserialization > --------------------------------------------------------- > > Key: AXIS-1771 > URL: http://issues.apache.org/jira/browse/AXIS-1771 > Project: Axis > Type: Bug > Components: Basic Architecture > Versions: 1.2RC2 > Environment: JDK 1.4.2, Mac OS X, Linux, Windows > Reporter: Peter Molettiere > Assignee: Venkat Reddy > Attachments: SOAPmsg_multiref_false.xml, SOAPmsg_multiref_true.xml, > SerializationContext.java.diff, memory-use-test.tgz, recursion.png > > Axis uses pathological amounts of memory during the > serialization/deserialization process. > We see about a 30 to 1 ratio of memory used during (de)serialization to > in-memory representation of the objects being (de)serialized. So ser/deser in > axis of a 2M graph of objects uses 288M of memory! Further, the memory used > seems to scale linearly with the size of the object graph being serialized. > The memory used does seem to be released once serialization is done, so this > isn't a leak. > Using the attached example code, (based on the code used to demonstrate > AXIS-1423) you can see this behavior. The test automatically runs with a max > heap size of 1024M, and runs out of memory serializing a 28M object graph. > As provided, it generates the following output: > Buildfile: build.xml > build: > [javac] Compiling 1 source file to /Users/pietro/Work/Axis Memory > Test/build/classes > run: > [java] - Unable to find required classes (javax.activation.DataHandler > and javax.mail.internet.MimeMultipart). Attachment support is disabled. > [java] Created tree with 5 levels and 3 children at each level > [java] Axis used 13 MBytes to serialize 230 KBytes, a ratio of 30.0 > [java] GC freed 13 MBytes > [java] Created tree with 5 levels and 4 children at each level > [java] Axis used 71 MBytes to serialize 1 MBytes, a ratio of 31.0 > [java] GC freed 71 MBytes > [java] Created tree with 5 levels and 5 children at each level > [java] Axis used 288 MBytes to serialize 2 MBytes, a ratio of 51.0 > [java] GC freed 287 MBytes > [java] Created tree with 5 levels and 6 children at each level > [java] Axis used 671 MBytes to serialize 11 MBytes, a ratio of 29.0 > [java] GC freed 675 MBytes > [java] Created tree with 5 levels and 7 children at each level > [java] Out of Memory serializing 28 MBytes tree. > [java] Java Result: 1 > BUILD SUCCESSFUL > Total time: 2 minutes 51 seconds > Note that the ratios are halved from the reported values, since it includes > both serialization and deserialization of the object graph. So axis uses > 30.5M to serialize a 1M message, and another 30.5M to deserialize it, > resulting in the reported 71M reported above. Also, notice that the ratio > stays close to 30 to 1 regardless of object graph size. This is the linear > scaling I mention above. > Note also, that if you tweak the code to generate very small object graphs, > you see extremely high ratios, but I would expect this due to simple one-time > overhead to operate on very small amounts of data. That's why I start with > the graph size that I do. > -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira
