[pve-devel] r4847 - in pve-manager/pve2: bin/test lib/PVE www/templates

svn-commits at proxmox.com svn-commits at proxmox.com
Fri Jun 25 18:00:56 CEST 2010


Author: dietmar
Date: 2010-06-25 16:00:55 +0000 (Fri, 25 Jun 2010)
New Revision: 4847

Added:
   pve-manager/pve2/bin/test/perftest1.pl
Modified:
   pve-manager/pve2/lib/PVE/API2Client.pm
   pve-manager/pve2/www/templates/pve.conf.in
Log:

added a simple performance test



Added: pve-manager/pve2/bin/test/perftest1.pl
===================================================================
--- pve-manager/pve2/bin/test/perftest1.pl	                        (rev 0)
+++ pve-manager/pve2/bin/test/perftest1.pl	2010-06-25 16:00:55 UTC (rev 4847)
@@ -0,0 +1,62 @@
+#!/usr/bin/perl -w
+
+
+use strict;
+use Time::HiRes qw( usleep ualarm gettimeofday tv_interval );
+use PVE::API2Client;
+
+use Data::Dumper;
+
+# fixme: create correct ticket
+my $ticket = "root::root::";
+
+my $wcount = 4;
+my $qcount = 100;
+
+
+sub test_rpc {
+
+    my $conn = PVE::API2Client->new(
+	username => 'root',
+	password => 'admin',
+	#    ticket => $ticket,
+	host => 'lana',
+	#host => 'localhost',
+	);
+
+    for (my $i = 0; $i < $qcount; $i++) {
+	eval {
+	    my $res = $conn->get("api2/", {});
+	};
+
+	my $err = $@;
+
+	if ($err) {
+
+	    print "ERROR: $err\n";
+	    last;
+	}
+    }
+}
+my $workers;
+
+my $starttime = [gettimeofday];
+
+for (my $i = 0; $i < $wcount; $i++) {
+    if (my $pid = fork ()) {
+	$workers->{$pid} = 1;
+    } else {
+	test_rpc ();
+	exit (0);
+    }
+}
+
+
+# wait for children
+1 while (wait > 0);
+
+my $elapsed = int(tv_interval ($starttime) * 1000);
+
+my $tpq = $elapsed / ($wcount*$qcount);
+
+print "DONE: $tpq ms per query\n";


Property changes on: pve-manager/pve2/bin/test/perftest1.pl
___________________________________________________________________
Added: svn:executable
   + *

Modified: pve-manager/pve2/lib/PVE/API2Client.pm
===================================================================
--- pve-manager/pve2/lib/PVE/API2Client.pm	2010-06-25 15:02:32 UTC (rev 4846)
+++ pve-manager/pve2/lib/PVE/API2Client.pm	2010-06-25 16:00:55 UTC (rev 4847)
@@ -72,7 +72,7 @@
 
     # print $ua->{cookie_jar}->as_string;
 
-    print "CALL $method : " .  $uri->as_string() . "\n";
+    #print "CALL $method : " .  $uri->as_string() . "\n";
  
     my $response;
     if ($method eq 'GET') {
@@ -88,7 +88,7 @@
 	die "method $method not implemented\n";
     }
 			      
-    print "RESP: " . Dumper($response) . "\n";
+    #print "RESP: " . Dumper($response) . "\n";
 
     if ($response->is_success) {
 	my $ct = $response->header('Content-Type');

Modified: pve-manager/pve2/www/templates/pve.conf.in
===================================================================
--- pve-manager/pve2/www/templates/pve.conf.in	2010-06-25 15:02:32 UTC (rev 4846)
+++ pve-manager/pve2/www/templates/pve.conf.in	2010-06-25 16:00:55 UTC (rev 4847)
@@ -3,7 +3,7 @@
     MinSpareServers 1 
     MaxSpareServers 2
     MaxClients          50
-    MaxRequestsPerChild 30
+    MaxRequestsPerChild 200
 </IfModule>
 
 ServerName localhost
@@ -47,7 +47,7 @@
 # avoid authentication when accessing favicon
 Alias /favicon.ico @WWW_IMAGEDIR@/favicon.ico
 
-PerlRequire @WWW_BASEDIR@/startup.pl
+#PerlRequire @WWW_BASEDIR@/startup.pl
 
 <Location /index.pl>
        SetHandler perl-script	
@@ -79,14 +79,6 @@
     RewriteEngine on
     RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
     RewriteRule .* - [F]
-    RewriteCond %{REQUEST_URI} !^/nrd/
-    RewriteCond %{REQUEST_URI} !^/images/
-    RewriteCond %{REQUEST_URI} !^/css/
-    RewriteCond %{REQUEST_URI} !^/ext/
-    RewriteCond %{REQUEST_URI} !^/javascript/
-    RewriteCond %{REQUEST_URI} !^/vncterm/
-    RewriteCond %{REQUEST_URI} !^/.*\.js$
-    RewriteCond %{REQUEST_URI} !^/login.pl$
     RewriteRule ^/(.*) https://%{HTTP_HOST}/$1 [L,R]
 </VirtualHost>
 



More information about the pve-devel mailing list