Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

adding more help.

remove some not working code.
  • Loading branch information...
commit c98b5ed8bd029c6b73128446eb4a5b02369382c5 1 parent 69cbce3
@shafiev authored
Showing with 14 additions and 56 deletions.
  1. +7 −46 benchmark.pl
  2. +7 −10 lib/AnyEvent/HTTPBenchmark.pm
View
53 benchmark.pl
@@ -1,21 +1,19 @@
#!/usr/bin/env perl
-use common::sense; #new features in perl(not for 5.8.8 and older (; )
-use AnyEvent::HTTP; # main module
+use common::sense; #new features in perl
use Getopt::Long; # to command line parsing
use POSIX;
-use Data::Dumper; # to see the date in debug
+use Data::Dumper; # to debug data
my $DEBUG = 0; #Debug mode. Default is false (0)
my $verbose = 0; #to view the each connection result
my $timeout = 60;
my $count = 30000; #number of requests
my $concurency = 20; # number of parralle requests
my $done = 0; #number of done requests
-my $url;
+my $url; # the url to test
my $method = 'GET'; #http method
my $proxy; # proxy server
-my $file; #scenario file(for future use);
my $max_recurse = 10; # the default recurse number;
-my $useragent = 'Mozilla/5.0 (compatible; U; AnyEvent::HTTPBenchmark/0.05; +http://github.com/shafiev/AnyEvent-HTTPBenchmark)';
+my $useragent = 'Mozilla/5.0 (compatible; U; AnyEvent::HTTPBenchmark/0.06; +http://github.com/shafiev/AnyEvent-HTTPBenchmark)';
#arrays
my @reqs_time; # the times of requests
@@ -27,44 +25,6 @@
$AnyEvent::HTTP::set_proxy = $proxy;
$AnyEvent::HTTP::USERAGENT = $useragent;
-
-=for 1
-# Caching results of AnyEvent::DNS::a
-# really hack code.will rewrited in nearest future
-my $orig_anyeventdnsa = \&AnyEvent::DNS::a;
-my %result_cache;
-my %callback_cache;
-*AnyEvent::DNS::a = sub($$) {
- my ($domain, $cb) = @_;
-
- if ($result_cache{$domain}) {
- $cb->( @{ $result_cache{$domain} } );
- return;
- }
-
- if ($callback_cache{$domain}) {
- push @{ $callback_cache{$domain} }, $cb;
- return;
- }
-
- $callback_cache{$domain} = [];
-
- $orig_anyeventdnsa->( $domain,
- sub {
- $result_cache{$domain} = [ @_ ];
- $cb->( @_ );
- while ( my $cached_cb = shift @{ $callback_cache{$domain} } ) {
- $cached_cb->( @_ );
- }
- }
- );
-
- return;
-};
-# End of caching
-# End of MegaKostil'
-=cut
-
#on ctrl-c break run the end_bench sub.
$SIG{'INT'} = 'end_bench';
@@ -100,10 +60,10 @@ sub parse_command_line {
-useragent useragent string
Example :
- ./benchmark.pl -url=http://myfavouritesite.com -n=number_of_requests -c=number_of_parrallel clients
+ ./benchmark.pl -url http://myfavouritesite.com -n number_of_requests -c number_of_parrallel clients
Another example :
- ./benchmark.pl --url=http://example.com -n=100 -c=10 -v
+ benchmark.pl --url http://example.com -n 100 -c 10 -v
HEREDOC
@@ -122,6 +82,7 @@ sub parse_command_line {
);
if ($concurency > $count) {
+ #the mini hack to prevoid stupid cases ;)
$concurency = $count;
}
View
17 lib/AnyEvent/HTTPBenchmark.pm
@@ -9,26 +9,23 @@ AnyEvent::HTTPBenchmark - The tool to make benchmark good and easy!
=head1 VERSION
-Version 0.05
+Version 0.06
=cut
-our $VERSION = '0.05';
+our $VERSION = '0.06';
=head1 SYNOPSIS
+The apache benchmark (ab) , siege, jmeter and etc, are sometimes awesome to make http-load testing. But if
+you want make some non-traditional test they are not good decision.This module try to help you in this case.
+Currently implemented just test utility , not a library .
-Quick summary of what the module does.
-
-Perhaps a little code snippet.
-
- use AnyEvent::HTTPBenchmark;
-
+ benchmark.pl --url http://example.com -n 100 -c 10 -v
=head1 EXPORT
-A list of functions that can be exported. You can delete this section
-if you don't export anything, such as for a purely object-oriented module.
+Currently no export functions are implemented.
=head1 SUBROUTINES/METHODS
Please sign in to comment.
Something went wrong with that request. Please try again.