Hi All, I am trying out a jmeter like tool with perl.The following are the tasks that my perl script needs to do.
1) Fire specified number of http requests in one second. 2) log the response times of the request. 3) the Thread should be freed once it completes the task. The following are the issues i am facing. 1) I am getting the following errors * Free to wrong pool xxx not yyy at C:/Perl/lib/**constant.pm*<http://constant.pm/> * line -1." and Free to wrong pool xxx not yyy at C:/Perl/lib/XSLoader.pm line -1." *randomly. 2) I have said the perl script to fire 100 simaltaneous request in one second ,but it is firing 100 requests in 6 seconds. 3) help me in freeing the thread as soon as it completes the task. *my environment* : *OS:* WinXp ,(SP2) *PERL: *perl v5.8.8 built for MSWin32-x86-multi-thread,Binary build 822 [280952] provided by ActiveState http://www.ActiveState.com Please go through the following code and help me in resolving the issues: ########### SNIP use 5.8.8; use strict; use warnings; use LWP; use LWP::Simple; use threads; use Time::HiRes qw/gettimeofday/; sub HTTP_Req { my($tid,$host,$port,$uri)=...@_; open my $FH, '>>', "test.csv" or die "$!"; my $req = new HTTP::Request 'POST'; my $url='http:' . '//' . $host . ':' . $port . $uri; my $ua = new LWP::UserAgent; $req->url($url); $req->header(Host => $host); $req->user_agent($ua->agent); $req->content_type('text/html'); my ($st_secs,$st_mins,$st_hours)=localtime(time); my ($seconds, $fraction) = gettimeofday(); $seconds = $seconds * 1000; my $st_ms = $fraction + $seconds; my $res = $ua->request($req); ($seconds, $fraction) = gettimeofday(); $seconds = $seconds * 1000; my $end_ms = $fraction + $seconds; my $resp_time=$end_ms - $st_ms; my ($end_secs,$end_mins,$end_hours)=localtime(time); my $resp_code=$res->code; if ($res->is_success) { print $FH "$tid,$st_hours:$st_mins:$st_secs,$end_hours:$end_mins:$end_secs,$st_ms,$end_ms,$resp_time,$resp_code,SUCCESS\n"; } else { print $FH "$tid,$st_hours:$st_mins:$st_secs,$end_hours:$end_mins:$end_secs,$st_ms,$end_ms,$resp_time,$resp_code,FAIL\n"; } close $FH; } my @threads; my $host='domain.xyz.com'; my $port='80'; my $uri='/'; my $threads=100; open my $FH, '>', "test.csv" or die "$!"; print $FH "tid,start_time,end_time,start Ms,End Ms,Response Time,ResponseCode,Result\n"; close $FH; for (1 .. 100) { my $thr = threads->create(\&HTTP_Req, $_,$host,$port,$uri); push(@threads,$thr); } $_->join foreach(@threads); ######### SNIP Awaiting for your reply. Thanks, PP.