Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: SOAP::Lite How to use persistent connection across fork process
by zentara (Cardinal) on Jul 10, 2012 at 16:31 UTC |