Before I get further lost in this I wonder if anyone else believes or
has comments on the following extract of a Devel::NYTProf run. The
code uses LWP::UserAgent in a POE server to retrieve ~ 30Mb file on
the local 1Gb network (and it takes over 400s). We are NOT using
LWP::UserAgent::POE - in fact it is not even installed on this
machine. I fail to see how line 158 below can take 320s. This is a
POST request to an apache server with a small amount of Perl to read
the file and check it belongs to the person who is retrieving it. Run
outside of the POE Server the same POST takes around 5s with this
code:
use LWP::UserAgent;
use HTTP::Request;
my $ua = LWP::UserAgent->new();
$get = HTTP::Request->new('POST', 'http://xxx.yyy.zzz/cgi/x.cgi?
job_id=697171&session_id=892416290D9E04EFE040007F01006F5B');
my $r = $ua->request($get);
and this is the same code being run inside the POE Server.
Devel::NYTProf reports the top time in HTTP::Message::add_content like
this:
149 sub add_content
150
# spent 320s (320+149ms) within HTTP::Message::add_content which was
called 7585 times, avg 42.3ms/call: # 7585 times (320s+149ms) by
LWP::Protocol::__ANON__[/usr/local/share/perl/5.10.0/LWP/Protocol.pm:
139] at line 137 of LWP/Protocol.pm, avg 42.3ms/call
{
151 7585 12.0ms my $self = shift;
152 7585 22.4ms $self->_content unless exists
$self->{_content};
153 7585 14.5ms my $chunkref = \$_[0];
154 7585 14.7ms $chunkref = $$chunkref if
ref($$chunkref); # legacy
155
156 7585 66.2ms 7585 149ms _utf8_downgrade($$chunkref);
# spent 149ms making 7585 calls to HTTP::Message::__ANON__[HTTP/
Message.pm:18], avg 20µs/call
157
158 7585 320s my $ref = ref($self->{_content});
159 7585 53.9ms if (!$ref) {
160 7585 365ms $self->{_content} .= $$chunkref;
161 }
162 elsif ($ref eq "SCALAR") {
163 ${$self->{_content}} .= $$chunkref;
164 }
165 else {
166 Carp::croak("Can't append to $ref
content");
167 }
168 7585 242ms delete $self->{_parts};
169 }
POE::Kernel::CORE:sselect is next with an exclusive time of 103s which
I can imagine is the waiting for data to be sent from Apache.
Unfortunately this is a huge bit of code and I've been unsuccessful in
reducing it to a small example which exhibits the same problem so far.
I'd appreciate any comments or suggestions before I go any further in
case someone sees something obvious I've missed.
Thanks.
--
You've received this message because you are subscribed to
the Devel::NYTProf Development User group.
Group hosted at: http://groups.google.com/group/develnytprof-dev
Project hosted at: http://perl-devel-nytprof.googlecode.com
CPAN distribution: http://search.cpan.org/dist/Devel-NYTProf
To post, email: [email protected]
To unsubscribe, email: [email protected]