Hello monks,

I am trying to use SOAP::Lite to test our server under load. I need HTTP keep_alive capability so that all the request are made over the same connection.
The design I have in mind is to fork every service request. The pseudo code is something like this...

use SOAP::Lite; my $soap_client = SOAP::Lite->uri('myuri') ->proxy('http://serviceendpoint', timeout => 30, keep_alive => 1); for (1 .. 10) { if(fork()) { #--- do something in parent #-- like wait for time specified by load rate etc. sleep(1); #--- just for pseudo code } else { $soap_client->call('SomeMethod',$paramter); } }

With the above what I am observing is that the SOAP client object in the forked child process closes the TCP connection after it gets the response from the server. I think this is because of the use of fork and the copy of the object going away after the child process is done. Is there a way around this so that the soap client uses the same connection (transport) across multiple forked processes?
Thanks. DP.

p.s.: I tried a bit to play around with IPC::Shareable but get some cryptic error Can't store CODE items at blib/lib/Storable.pm

p.p.s: In reality I am achieving the forking using POE and POE::Wheel::Run. The issue is the same as with the use of basic fork as above.


In reply to SOAP::Lite How to use persistent connection across fork process by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.