#139 Large memory consumption upon request to operation

0.65
open-accepted
5
2014-10-03
2008-01-28
Anonymous
No

I am using SOAP::Lite for the runAtlas operation here:
http://www.cbs.dtu.dk/ws/BLASTatlas/BLASTatlas_1_0.wsdl
...using this example:
http://www.cbs.dtu.dk/ws/BLASTatlas/examples/figure5.pl
The script uses ~105Mb to the point exactly before running the SOAP operation. At the point before the request has been submitted, the script consumes ~650Mb of memory, and 5-10 minuttes of processing. By inspecting the uploaded XML on the server side, the messages only takes up 20Mb (uncompressed) - does serialization really demand this much memory?

I am using SOAP::Lite version 0.69.

Discussion

  • Martin Kutter

    Martin Kutter - 2008-01-30
    • status: open --> closed-wont-fix
     
  • Martin Kutter

    Martin Kutter - 2008-01-30

    Logged In: YES
    user_id=884175
    Originator: NO

    Unfortunately it does.

    SOAP::Lite stores it's data in SOAP::Data objects, which are hash-based. This means that every XML node is a blessed hash reference, and a empty hash ref in perl eats up around 1kB of memory (it won't grow until you added 1k of key/value pairs, but that's cold comfort).

    A quick guess tells me that there are ~500 000 XML nodes in your 20MB of XML - and that's around 500 MB of perl data structures.

    SOAP::Lite also copies the serialized XML around several times (to the trace facility, to the transport layer...) - but that's probably only around 50 of your 650 MB.

    You may want to try the 2.00_xx pre-releases of SOAP::WSDL - it uses inside out classes for storing data which are more memory-efficient, but it currently only handles WSDL-described document/literal web services and does not support the full range of XML Schema Definitions.

     
  • Peter Hallin

    Peter Hallin - 2008-02-01

    Logged In: YES
    user_id=1993712
    Originator: NO

    >SOAP::Lite stores it's data in SOAP::Data objects, which are hash-based.
    This is not the cause for this memory consumption; At the moment /just/ before posting the request, the script takes up 175Mb and at this point the SOPA::Data object has already been created (this bit takes short time - 30 sec). Once the object is created and ready to be posted, this is what takes the time (2 min) and space (500Mb). We cannot detect any activity from our web server for most of this time. In fact, when running the +trace debug, we can see, that the xml is generated after those 30 sec - and after the XML has been printed the process starts eating memory (for 2 mins). The response is only a very short message (a job identifier)

     
  • Martin Kutter

    Martin Kutter - 2008-02-01

    Logged In: YES
    user_id=884175
    Originator: NO

    OK, this means we have to investigate.

    Have you some hints where in the script (line number) the memory consumption starts to grow?

    Does the script (or the other script spawned from it) do multiple SOAP requests? SOAP::Lite 0.69 has a known memory leak - if you're doing multiple SOAP requests, you may want to try the newest 0.70_0x pre-release.

    Martin

     
  • Martin Kutter

    Martin Kutter - 2008-02-01
    • assigned_to: byrnereese --> kutterma
    • status: closed-wont-fix --> open-accepted
     
  • Peter Hallin

    Peter Hallin - 2008-02-02

    Logged In: YES
    user_id=1993712
    Originator: NO

    Thank you for your quick response. I have boiled down the original script, and made a short version which illustrates the problem: http://www.cbs.dtu.dk/ws/BLASTatlas/examples/report.pl

    At line 31, where the SOAP operation runs, is where the problem is: In this example, memory goes from 184Mb, to 1,586Mb during this step (15 minutes of processing) On the server side (which uses XML::Simple to parse the XML) it takes only 271Mb and less than two minutes to process the request. During the 15 minutes of crunching, there is no process running on the server side, recieving data.

    I'll be glad to assist with further debugging ...

     
  • Martin Kutter

    Martin Kutter - 2008-04-17

    Logged In: YES
    user_id=884175
    Originator: NO

    Hi,

    SOAP-Lite-0.71.02 fixed a memory hole, which might be one of the causes - so it might be worth trying.

    I cannot access http://www.cbs.dtu.dk/ws/BLASTatlas/examples/report.pl, so I can't look...

    Martin

     
  • Martin Kutter

    Martin Kutter - 2008-04-18

    Logged In: YES
    user_id=884175
    Originator: NO

    Hi,

    running figure5.pl under SOAP-Lite-v0.71.03 on my machine gives the following result while using up to 226 MB of (resident) memory (virtual size is only slightly higher):

    loading wsdl ...
    loading proteins of database lanes ...
    getting genome sequence of reference genome ...
    requesting coding annotations and translations of reference genome ...
    requesting cds, trna, and rrna annotations of reference genome ...
    building soap object holding database elements ...
    building blast atlas request message ...
    submitting blast atlas request ...
    waiting for job 94cb0802779bc97ba34dbe9fc8d117ab ...
    faultcode:soap:server:job status:FAILED
    faultstring:operation returned value 65280

    I don't know whether the memory explosion you observed has been in the steps before the job failed - if it is, it's probably due to the fixed memory leaks in SOAP::Lite up to 0.71.01.

    The script itself is a wastrel memory-wise, too: all variables are globally scoped, which means they're not released until the script ends.
    Scoping (by introducing subroutines, or even by just using {} blocks should help.

    Martin

     

Log in to post a comment.