[PATCH] Reduce prefork worker threads created by CI

Tim Beale timbeale at catalyst.net.nz
Wed Feb 13 00:40:09 UTC 2019


This patch reduces the number of processes created when running the
samba-ad-dc-backup autobuild job. It might help to use CI resources
slightly more efficiently.

CI pass: https://gitlab.com/catalyst-samba/samba/pipelines/47245542

Review appreciated, thanks.

-------------- next part --------------
From 146239fd50c289f12f36607a3968db2e6a74eb4f Mon Sep 17 00:00:00 2001
From: Tim Beale <timbeale at catalyst.net.nz>
Date: Tue, 5 Feb 2019 12:18:38 +1300
Subject: [PATCH 1/2] selftest: Use default 'prefork children' smb.conf setting

The default setting should be 4, so there should be no need to specify
this in the testenv smb.conf.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
---
 selftest/target/Samba4.pm | 2 --
 1 file changed, 2 deletions(-)

diff --git a/selftest/target/Samba4.pm b/selftest/target/Samba4.pm
index d8e066f..c0f5579 100755
--- a/selftest/target/Samba4.pm
+++ b/selftest/target/Samba4.pm
@@ -794,8 +794,6 @@ sub provision_raw_step1($$)
 	dreplsrv:periodic_startup_interval = 0
 	dsdb:schema update allowed = yes
 
-        prefork children = 4
-
         vfs objects = dfs_samba4 acl_xattr fake_acls xattr_tdb streams_depot
 
         idmap_ldb:use rfc2307=yes
-- 
2.7.4


From 199b5a8e8e6c39c5a01f3dec69f3750be5a04f72 Mon Sep 17 00:00:00 2001
From: Tim Beale <timbeale at catalyst.net.nz>
Date: Tue, 5 Feb 2019 12:23:43 +1300
Subject: [PATCH 2/2] selftest: Change backup/restore testenvs to use 1 prefork
 child

Recently the gitlab CI jobs were hitting memory resource limits and
using swap, which then caused test failures. The process model used in
the testenvs seemed to be contributing to this problem.

We can reduce the memory overhead of the restore/backup testenvs by
using 1 prefork child process instead of the default of 4 (kudos to
Garming for the idea). The tests run against these testenvs are basic
sanity-checks, rather than heavy-duty stress tests, so the number of
prefork workers shouldn't matter.

This is a bit of a tradeoff between testing the defaults that will
actually be used in production vs using limited resources efficiently on
shared CI runner machines.

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
---
 selftest/target/Samba4.pm | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/selftest/target/Samba4.pm b/selftest/target/Samba4.pm
index c0f5579..647e1f1 100755
--- a/selftest/target/Samba4.pm
+++ b/selftest/target/Samba4.pm
@@ -3081,7 +3081,8 @@ sub setup_restoredc
 	# we arbitrarily designate the restored DC as having SMBv1 disabled
 	my $extra_conf = "
 	server min protocol = SMB2
-	client min protocol = SMB2";
+	client min protocol = SMB2
+	prefork children = 1";
 
 	my ($env, $ctx) = $self->prepare_dc_testenv($prefix, "restoredc",
 						    $dcvars->{DOMAIN},
@@ -3124,11 +3125,12 @@ sub setup_renamedc
 	# note: dcvars contains the env info for the dependent testenv ('backupfromdc')
 	my ($self, $prefix, $dcvars) = @_;
 	print "Preparing RENAME DC...\n";
+	my $extra_conf = "prefork children = 1";
 
 	my $realm = "renamedom.samba.example.com";
 	my ($env, $ctx) = $self->prepare_dc_testenv($prefix, "renamedc",
 						    "RENAMEDOMAIN", $realm,
-						    $dcvars->{PASSWORD}, "");
+						    $dcvars->{PASSWORD}, $extra_conf);
 
 	# create a backup of the 'backupfromdc' which renames the domain
 	my $backupdir = File::Temp->newdir();
@@ -3171,11 +3173,12 @@ sub setup_offlinebackupdc
 	# note: dcvars contains the env info for the dependent testenv ('backupfromdc')
 	my ($self, $prefix, $dcvars) = @_;
 	print "Preparing OFFLINE BACKUP DC...\n";
+	my $extra_conf = "prefork children = 1";
 
 	my ($env, $ctx) = $self->prepare_dc_testenv($prefix, "offlinebackupdc",
 						    $dcvars->{DOMAIN},
 						    $dcvars->{REALM},
-						    $dcvars->{PASSWORD}, "");
+						    $dcvars->{PASSWORD}, $extra_conf);
 
 	# create an offline backup of the 'backupfromdc' target
 	my $backupdir = File::Temp->newdir();
@@ -3215,11 +3218,12 @@ sub setup_labdc
 	# note: dcvars contains the env info for the dependent testenv ('backupfromdc')
 	my ($self, $prefix, $dcvars) = @_;
 	print "Preparing LAB-DOMAIN DC...\n";
+	my $extra_conf = "prefork children = 1";
 
 	my ($env, $ctx) = $self->prepare_dc_testenv($prefix, "labdc",
 						    "LABDOMAIN",
 						    "labdom.samba.example.com",
-						    $dcvars->{PASSWORD}, "");
+						    $dcvars->{PASSWORD}, $extra_conf);
 
 	# create a backup of the 'backupfromdc' which renames the domain and uses
 	# the --no-secrets option to scrub any sensitive info
-- 
2.7.4



More information about the samba-technical mailing list