You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Adi <ad...@certsite.com> on 2000/04/18 23:41:57 UTC

[OT] LWP: Regression testing a mod_perl server

I am trying to put together a comprehensive regression suite for CGI based
mod_perl web applications using LWP.  It involves sequences of CGI calls
with expected results after each consecutive request.  But I noticed
something about LWP: it caches requests, almost like it expects *only*
static content.  So if you loop over a given sequence of HTTP requests, only
the first one actually gets sent to the server.

  eg:

foreach (1..5) {
   $ua->request(GET ('http://localhost/uri1'));
   $ua->request(GET ('http://localhost/uri2'));
   $ua->request(GET ('http://localhost/uri3'));
}

# this code will only send 3 requests to the webserver, NOT 15

Has anyone done similar work making a regression test using LWP ?  Is there
an easy way to turn off this caching behavior?

-Adi

Re: [OT] LWP: Regression testing a mod_perl server

Posted by Stas Bekman <sb...@stason.org>.
On Tue, 18 Apr 2000, Adi wrote:

> Cool, thanks for the quick response, Stas.
> 
> I don't seem to have LWP::Parallel.  Looks like I need to upgrade to the
> newest version of LWP.  But yes, I did notice that ab gives much more
> accurate results.  I was using Time::HiRes to simply measure the time it
> takes from request to response, and it gave widely varying results.  Which
> was why I wanted to do a loop so I could divide the total time taken by the
> number of iterations.

Well, it's almost useless to benchmark by running a single query. I don't
know how did you want to do that without LWP::Parallel.

> I'm glad to hear you're already working on it.  I'll definitely help out
> with your regression suite, because I haven't gotten too far on mine (I
> just started working on it today). 

I've started 2 days ago when I've got tired from running the benchmarks
for the Guide manually and parse the results... Hold on and you might get
my version very soon now :)


> 
> Thanks for the LWP list ref.. I'll post the question there.
> 
> -Adi
> 
> Stas Bekman wrote:
> > 
> > First I work on a similar suite as well. I didn't want to announce it yet,
> > before I get some things working. But since you've mentioned it here, here
> > we go... Hope to get the first version out of the door in a few days.
> > 
> > Regarding LWP, I've used a similar to ab script as described at
> > http://perl.apache.org/guide/performance.html and I've found the results
> > are very different if you the same test with ab and LWP::Parallel, so I'd
> > not recommend using it if you want to figure out the *real* numbers. Do
> > you see a different behavior with your tests?
> > 
> > So based on these findings I use ab and parse the output to make a
> > different report than ab does.
> > 
> > I didn't find the answer for your original answer in the  LWP::UserAgent
> > manpage, but probably the right address is the libwww list:
> > 
> >        The latest version of this library is likely to be
> >        available from CPAN as well as:
> > 
> >         http://www.linpro.no/lwp/
> > 
> >        The best place to discuss this code is on the
> >        <li...@perl.org> mailing list.
> > 
> > ______________________________________________________________________
> > Stas Bekman             | JAm_pH    --    Just Another mod_perl Hacker
> > http://stason.org/      | mod_perl Guide  http://perl.apache.org/guide
> > mailto:stas@stason.org  | http://perl.org    http://stason.org/TULARC/
> > http://singlesheaven.com| http://perlmonth.com http://sourcegarden.org
> > ----------------------------------------------------------------------
> 
> 



______________________________________________________________________
Stas Bekman             | JAm_pH    --    Just Another mod_perl Hacker
http://stason.org/      | mod_perl Guide  http://perl.apache.org/guide 
mailto:stas@stason.org  | http://perl.org    http://stason.org/TULARC/
http://singlesheaven.com| http://perlmonth.com http://sourcegarden.org
----------------------------------------------------------------------


Re: [OT] LWP: Regression testing a mod_perl server

Posted by Adi <ad...@certsite.com>.
Cool, thanks for the quick response, Stas.

I don't seem to have LWP::Parallel.  Looks like I need to upgrade to the
newest version of LWP.  But yes, I did notice that ab gives much more
accurate results.  I was using Time::HiRes to simply measure the time it
takes from request to response, and it gave widely varying results.  Which
was why I wanted to do a loop so I could divide the total time taken by the
number of iterations.

I'm glad to hear you're already working on it.  I'll definitely help out
with your regression suite, because I haven't gotten too far on mine (I just
started working on it today).

Thanks for the LWP list ref.. I'll post the question there.

-Adi

Stas Bekman wrote:
> 
> First I work on a similar suite as well. I didn't want to announce it yet,
> before I get some things working. But since you've mentioned it here, here
> we go... Hope to get the first version out of the door in a few days.
> 
> Regarding LWP, I've used a similar to ab script as described at
> http://perl.apache.org/guide/performance.html and I've found the results
> are very different if you the same test with ab and LWP::Parallel, so I'd
> not recommend using it if you want to figure out the *real* numbers. Do
> you see a different behavior with your tests?
> 
> So based on these findings I use ab and parse the output to make a
> different report than ab does.
> 
> I didn't find the answer for your original answer in the  LWP::UserAgent
> manpage, but probably the right address is the libwww list:
> 
>        The latest version of this library is likely to be
>        available from CPAN as well as:
> 
>         http://www.linpro.no/lwp/
> 
>        The best place to discuss this code is on the
>        <li...@perl.org> mailing list.
> 
> ______________________________________________________________________
> Stas Bekman             | JAm_pH    --    Just Another mod_perl Hacker
> http://stason.org/      | mod_perl Guide  http://perl.apache.org/guide
> mailto:stas@stason.org  | http://perl.org    http://stason.org/TULARC/
> http://singlesheaven.com| http://perlmonth.com http://sourcegarden.org
> ----------------------------------------------------------------------


Re: [OT] LWP: Regression testing a mod_perl server

Posted by Stas Bekman <sb...@stason.org>.
> I am trying to put together a comprehensive regression suite for CGI based
> mod_perl web applications using LWP.  It involves sequences of CGI calls
> with expected results after each consecutive request.  But I noticed
> something about LWP: it caches requests, almost like it expects *only*
> static content.  So if you loop over a given sequence of HTTP requests, only
> the first one actually gets sent to the server.
> 
>   eg:
> 
> foreach (1..5) {
>    $ua->request(GET ('http://localhost/uri1'));
>    $ua->request(GET ('http://localhost/uri2'));
>    $ua->request(GET ('http://localhost/uri3'));
> }
> 
> # this code will only send 3 requests to the webserver, NOT 15
> 
> Has anyone done similar work making a regression test using LWP ?  Is there
> an easy way to turn off this caching behavior?

First I work on a similar suite as well. I didn't want to announce it yet,
before I get some things working. But since you've mentioned it here, here
we go... Hope to get the first version out of the door in a few days.

Regarding LWP, I've used a similar to ab script as described at
http://perl.apache.org/guide/performance.html and I've found the results
are very different if you the same test with ab and LWP::Parallel, so I'd
not recommend using it if you want to figure out the *real* numbers. Do
you see a different behavior with your tests?

So based on these findings I use ab and parse the output to make a
different report than ab does.

I didn't find the answer for your original answer in the  LWP::UserAgent
manpage, but probably the right address is the libwww list:

       The latest version of this library is likely to be
       available from CPAN as well as:

        http://www.linpro.no/lwp/

       The best place to discuss this code is on the
       <li...@perl.org> mailing list.

______________________________________________________________________
Stas Bekman             | JAm_pH    --    Just Another mod_perl Hacker
http://stason.org/      | mod_perl Guide  http://perl.apache.org/guide 
mailto:stas@stason.org  | http://perl.org    http://stason.org/TULARC/
http://singlesheaven.com| http://perlmonth.com http://sourcegarden.org
----------------------------------------------------------------------