perl-test-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rj...@apache.org
Subject svn commit: r1852311 - /perl/Apache-Test/trunk/lib/Apache/TestConfig.pm
Date Sun, 27 Jan 2019 23:45:56 GMT
Author: rjung
Date: Sun Jan 27 23:45:56 2019
New Revision: 1852311

URL: http://svn.apache.org/viewvc?rev=1852311&view=rev
Log:
More sizing improvements for the MPMs.
Add -threadsperchild, make sure that
MinSpare and MaxSpare have a bit of delta and
MaxClients is above MaxSpare.
This reduces occurences of sizing based warnings
especially during httpd test framework runs
with worker and prefork MPM.

Modified:
    perl/Apache-Test/trunk/lib/Apache/TestConfig.pm

Modified: perl/Apache-Test/trunk/lib/Apache/TestConfig.pm
URL: http://svn.apache.org/viewvc/perl/Apache-Test/trunk/lib/Apache/TestConfig.pm?rev=1852311&r1=1852310&r2=1852311&view=diff
==============================================================================
--- perl/Apache-Test/trunk/lib/Apache/TestConfig.pm (original)
+++ perl/Apache-Test/trunk/lib/Apache/TestConfig.pm Sun Jan 27 23:45:56 2019
@@ -82,6 +82,7 @@ use vars qw(%Usage);
    httpd_conf_extra=> 'inherit additional config from this file',
    minclients      => 'minimum number of concurrent clients (default is 1)',
    maxclients      => 'maximum number of concurrent clients (default is minclients+1)',
+   threadsperchild => 'number of threads per child when using threaded MPMs (default is
10)',
    perlpod         => 'location of perl pod documents (for testing downloads)',
    proxyssl_url    => 'url for testing ProxyPass / https (default is localhost)',
    sslca           => 'location of SSL CA (default is $t_conf/ssl/ca)',
@@ -326,6 +327,7 @@ sub new {
     $vars->{group}        ||= $self->default_group;
     $vars->{serveradmin}  ||= $self->default_serveradmin;
 
+    $vars->{threadsperchild} ||= 10;
     $vars->{minclients}   ||= 1;
     $vars->{maxclients_preset} = $vars->{maxclients} || 0;
     # if maxclients wasn't explicitly passed try to
@@ -338,13 +340,33 @@ sub new {
         $vars->{maxclients_preset} < $vars->{minclients}) {
         $vars->{minclients} = $vars->{maxclients_preset};
     }
+    if ($vars->{minclients} < 2) {
+        $vars->{maxspare} = 2;
+    } else {
+        $vars->{maxspare} = $vars->{minclients};
+    }
+    if ($vars->{maxclients} < $vars->{maxspare} + 1) {
+        $vars->{maxclients} = $vars->{maxspare} + 1;
+    }
 
-    # for threaded mpms MaxClients must be a multiple of
-    # ThreadsPerChild (i.e. maxclients % minclients == 0)
-    # so unless -maxclients was explicitly specified use a double of
-    # minclients
-    $vars->{maxclientsthreadedmpm} =
-        $vars->{maxclients_preset} || $vars->{minclients} * 2;
+    # for threaded mpms MinClients and MaxClients must be a
+    # multiple of ThreadsPerChild
+    {
+        use integer;
+        $vars->{minclientsthreadedmpm} = ($vars->{minclients} + $vars->{threadsperchild}
- 1) /
+            $vars->{threadsperchild} * $vars->{threadsperchild};
+        $vars->{maxclientsthreadedmpm} = ($vars->{maxclients} + $vars->{threadsperchild}
- 1) /
+            $vars->{threadsperchild} * $vars->{threadsperchild};
+        $vars->{maxsparethreadedmpm} = ($vars->{maxspare} + $vars->{threadsperchild}
- 1) /
+            $vars->{threadsperchild} * $vars->{threadsperchild};
+        $vars->{startserversthreadedmpm} = $vars->{minclientsthreadedmpm} / $vars->{threadsperchild};
+    }
+    if ($vars->{maxsparethreadedmpm} < 2 * $vars->{threadsperchild}) {
+        $vars->{maxsparethreadedmpm} = 2 * $vars->{threadsperchild};
+    }
+    if ($vars->{maxclientsthreadedmpm} < $vars->{maxsparethreadedmpm} + $vars->{threadsperchild})
{
+        $vars->{maxclientsthreadedmpm} = $vars->{maxsparethreadedmpm} + $vars->{threadsperchild};
+    }
 
     $vars->{proxy}        ||= 'off';
     $vars->{proxyssl_url} ||= '';
@@ -524,8 +546,14 @@ sub configure_proxy {
         unless ($vars->{maxclients_preset}) {
             $vars->{minclients}++;
             $vars->{maxclients}++;
+            $vars->{maxspare}++;
+            $vars->{startserversthreadedmpm} ++;
+            $vars->{minclientsthreadedmpm} += $vars->{threadsperchild};
+            $vars->{maxclientsthreadedmpm} += $vars->{threadsperchild};
+            $vars->{maxsparethreadedmpm} += $vars->{threadsperchild};
             #In addition allow for some backend processes
-            #in keep-alive state
+            #in keep-alive state. For threaded MPMs we
+            #already should be fine.
             $vars->{maxclients} += 3;
         }
         $vars->{proxy} = $self->{vhosts}->{'mod_proxy'}->{hostport};
@@ -1412,8 +1440,14 @@ sub check_vars {
             unless ($vars->{maxclients_preset}) {
                 $vars->{minclients}++;
                 $vars->{maxclients}++;
+                $vars->{maxspare}++;
+                $vars->{startserversthreadedmpm} ++;
+                $vars->{minclientsthreadedmpm} += $vars->{threadsperchild};
+                $vars->{maxclientsthreadedmpm} += $vars->{threadsperchild};
+                $vars->{maxsparethreadedmpm} += $vars->{threadsperchild};
                 #In addition allow for some backend processes
-                #in keep-alive state
+                #in keep-alive state. For threaded MPMs we
+                #already should be fine.
                 $vars->{maxclients} += 3;
             }
         }
@@ -2200,10 +2234,10 @@ HostnameLookups Off
     LockFile             @t_logs@/accept.lock
 </IfVersion>
 </IfModule>
-    StartServers         1
-    MinSpareThreads      @MinClients@
-    MaxSpareThreads      @MinClients@
-    ThreadsPerChild      @MinClients@
+    StartServers         @StartServersThreadedMPM@
+    MinSpareThreads      @ThreadsPerChild@
+    MaxSpareThreads      @MaxSpareThreadedMPM@
+    ThreadsPerChild      @ThreadsPerChild@
     MaxClients           @MaxClientsThreadedMPM@
     MaxRequestsPerChild  0
 </IfModule>
@@ -2216,8 +2250,8 @@ HostnameLookups Off
 </IfModule>
     NumServers           1
     StartThreads         @MinClients@
-    MinSpareThreads      @MinClients@
-    MaxSpareThreads      @MinClients@
+    MinSpareThreads      1
+    MaxSpareThreads      @MaxSpare@
     MaxThreadsPerChild   @MaxClients@
     MaxRequestsPerChild  0
 </IfModule>
@@ -2229,8 +2263,8 @@ HostnameLookups Off
 </IfVersion>
 </IfModule>
     StartServers         @MinClients@
-    MinSpareServers      @MinClients@
-    MaxSpareServers      @MinClients@
+    MinSpareServers      1
+    MaxSpareServers      @MaxSpare@
     MaxClients           @MaxClients@
     MaxRequestsPerChild  0
 </IfModule>
@@ -2238,8 +2272,8 @@ HostnameLookups Off
 <IfDefine APACHE1>
     LockFile             @t_logs@/accept.lock
     StartServers         @MinClients@
-    MinSpareServers      @MinClients@
-    MaxSpareServers      @MinClients@
+    MinSpareServers      1
+    MaxSpareServers      @MaxSpare@
     MaxClients           @MaxClients@
     MaxRequestsPerChild  0
 </IfDefine>



Mime
View raw message