osstest Massachusetts test lab resource usage investigation
Because I have suspected that we are not getting as much out of the test lab as we could have, I have been doing some digging in the database.
I wrote some code to mine the database for historical information about resource usage. (Patch below, which I will push to osstest production at some point.)
I ran it on the last 92 days of history (strictly, 92 days starting 7 days ago, because for obscure technical reasons it doesn't want to look right at the most recent data).
The most noteworthy conclusion I have drawn is that about 30% of the capacity is not being used. That is, at any one time, on average, about ~30% of the capacity is idle.
Some of this will be inevitable: for example, if we need to shut the system down for maintenance, we will need to ask it to drain its queue so that it is idle by the start of the maintenance window.
It is also possible that some of this is a genuine lack of work to do, in the sense that the programmed test flights are not able to use the capacity. I don't think this is very likely (but I haven't yet figured out for sure). Certainly, my personal impression is that the lead time on tests has varied greatly; currently it is quite low because the stable trees haven't had recent updates.
Personal experience and ad-hoc log reading leads me to think that the biggest likely cause of idle test boxes is database contention. That is, there is work which the system in some sense knows it ought to be doing, but it is stuck on bookkeeping operations involved in setting up a flight, scheduling the jobs, and at the appropriate time allocating a test box for each such job, and son on. Depending on locking strategies, these database operations can be blocked by long-running report jobs. It is also possible that the database queries involved in host scheduling need tuning.
In parallel with the work I am reporting in this email, I am already taking steps to investigate the performance of the various database queries, and the situation with locking.
I hope that this will produce actionable ideas for improvement.
Additionally, each test box spends about ~16% of the time being wiped and reinstalled for each test. This is because the reinstallation time is significant when compared to the duration of each test. It is necessary to reinstall when a host was previously used by a completely different flight (which might involve a different hypervisor), or if we aren't sure that the previous test left the host in a good state. But most flights contain many similar host installations and most jobs leave the host in a good state.
So there is an opportunity for a worthwhile improvement in throughput by arranging for test host reuse within a flight.
osstest already understands sharing for the purpose of builds; making it share for tests, under the right conditions, is a moderately extensive, but straightforward, task.
About 4% of the capacity is used for builds, but a further 5% or so preparing a box to be a build host. We could probably optimise this by providing a few dedicated build hosts, as this would result in fewer reinstalls. We should consider this in our next round of provisioning.
(The report also claims that about 3% of the capacity is "unused" when a machine is configured for building, and osstest would be willing in principle to run multiple different builds at once, but for scheduling reasons only one build is running.)
Other interesting results: about 3-4% of the time is spent doing bisections.
Looking at the branches: the xen-unstable-smoke flights are about 3%. xen-unstable itself consumes the bulk of the capacity, at about 28%. qemu-mainline (which updates frequently) is the next biggest.
The graphs are generated using python3-matplotlib and shown on my workstation's X display. I haven't arranged for them to be output as PostScript or png or anything - instead I have put a screenshot here:
http://xenbits.xen.org/people/iwj/2016/mg-report-host-usage.2016-08-25.png
I'm afraid that this is likely to be rather opaque unless you look at the source code (in osstest, and the patch below) to see what the various categories mean. I also haven't bothered prettifying the formatting, beyond what's needed to be able to read the charts.
Thanks all for your attention.
Ian.
From 6895c84d890a2db9f68e7994198783c0e4465181 Mon Sep 17 00:00:00 2001
From: Ian Jackson <[email protected]>
Date: Thu, 25 Aug 2016 15:59:28 +0100
Subject: [OSSTEST PATCH] mg-report-host-usage-*: New admin debugging tools
These two tools can be used to dig into the osstest history and produce some graphs of what the system is spending its resources on.
--- mg-report-host-usage-collect | 443 +++++++++++++++++++++++++++++++++++++++++++ mg-report-host-usage-tuples | 124 ++++++++++++ 2 files changed, 567 insertions(+) create mode 100755 mg-report-host-usage-collect create mode 100755 mg-report-host-usage-tuples
mg-report-host-usage-collect new file +443 -0
@@ -0,0 +1,443 @@ +#!/usr/bin/perl -w + +# This is part of "osstest", an automated testing framework for Xen. +# Copyright (C) 2009-2016 Citrix Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + + +use strict qw(vars); + +use DBI; +use Osstest; +use IO::Handle; +use POSIX; +use JSON; +use Data::Dumper; +use Carp; + +$SIG{__WARN__} = sub { confess $_[0]; }; + +my %hh; # host history +# contains a list of phases +# a phase is "this host was used in this way during this period" +# initially phases may overlap in complex ways +# +# $hh{HOST}[]{From} = time_t +# $hh{HOST}[]{To} = time_t +# $hh{HOST}[]{KV}{Key} = VALUE +# +# Keys are the db results plus (caps are synth ones): +# +# PREP = boolish: 1 means was host install or h-build-prep +# SHAREABLE = boolish: 1 means was sharable during this period +# +# Calculated during consolidate: +# SHARES = 1 or 3 (or 'shared max tasks' host prop) +# IDLE = 1 or undef +# +# Combinations of the above +# OVERALL IDL +# TEST-PREP TEST +# BUILD-PREP BUILD BUILD-IDLE IDLE-PREPPED +# ^ idle share ^ all shares idle +# +# WEIGHT 1.0/SHARES (or 1.0) + +our $duration = 31 * 86400; +our $max_job_len = 86400 * 7; +our $progress = 1; +our $debug = 0; + +csreadconfig(); + +open DEBUG, "> /dev/null" or die $!; +open PROGR, ">& STDERR" or die $!; + +while (@ARGV) { + $_ = shift @ARGV; + last if m/^--?$/; + while (m/^-./) { + if (s/^-D/-/) { + open DEBUG, ">& STDERR" or die $!; + open PROGR, "> /dev/null" or die $!; + $debug = 1; + } elsif (s/^-q/-/) { + open PROGR, "> /dev/null" or die $!; + } elsif (s/^-l(\d+)([y|m|w|d])$//) { + $duration = $1 * ($2 eq 'y' ? 366 : + $2 eq 'm' ? 31 : + $2 eq 'w' ? 7 : + 1) * 86400; + } elsif (s/^--max-job-len=(\d+)$//) { + $max_job_len = $1; + } else { + die "$_ ?"; + } + } +} + +PROGR->autoflush(1); + +our $cutoff_end = time - $max_job_len; +our $cutoff_start = $cutoff_end - $duration; + +printf STDERR "cutoff start: %s\n", show_abs_time $cutoff_start; +printf STDERR "cutoff end: %s\n", show_abs_time $cutoff_end; + +our $last_progress = 0; + +sub progress1 { + print DEBUG "@_\n" if $debug; + printf PROGR "%-79.79s\r", "@_"; + $last_progress = time; +} + +sub progress { + return unless time > $last_progress; + print DEBUG "@_\n" if $debug; + local $debug = 0; + progress1 @_; +} + +my $propq = db_prepare(<<END); + SELECT val + FROM resource_properties + WHERE restype='host' + AND resname=? + AND name=? +END + +sub collectdata () { + my $startq = db_prepare(<<END); + SELECT * + FROM flights + WHERE flights.started >= ? + ORDER BY flight asc + LIMIT 1 +END + $startq->execute($cutoff_start - $max_job_len); + my ($minflight) = $startq->fetchrow_array(); + die unless defined $minflight; + + progress1 "minflight $minflight"; + + my $jobsq = db_prepare(<<END); + SELECT flights.flight flight, + flights.blessing blessing, + flights.branch branch, + flights.intended intended, + alloc.finished alloc_finished, + jobs.job job + FROM flights + JOIN jobs USING (flight) + JOIN steps alloc USING (flight,job) + WHERE flights.flight >= ? + AND alloc.step='ts-hosts-allocate' + AND alloc.status='pass' + AND alloc.finished IS NOT NULL +END + + my $prepq = db_prepare(<<END); + SELECT finished prep_finished, + status prep_status + FROM steps prep + WHERE flight=? and job=? + AND prep.finished IS NOT NULL + AND (prep.step='ts-host-build-prep' + OR prep.step like 'ts-host-install%') + ORDER BY stepno DESC + LIMIT 1 +END + + my $hostsq = db_prepare(<<END); + SELECT val, synth + FROM runvars + WHERE flight=? and job=? + AND (name like '%_host' or name='host') +END + + my $finishq = db_prepare(<<END); + SELECT max(finished) AS finished + FROM steps + WHERE flight=? and job=? +END + + progress1 "minflight $minflight executing..."; + $jobsq->execute($minflight); + + progress1 "minflight $minflight fetching..."; + $last_progress = 0; # forces next progress message to be printed + + while (my $jobrow = $jobsq->fetchrow_hashref()) { + my @fj = ($jobrow->{flight}, $jobrow->{job}); + progress "PROCESSING @fj"; + my @kvs = (%$jobrow); + + $finishq->execute(@fj); + my ($finish) = $finishq->fetchrow_array(); + die "@fj ?" unless defined $finish; + + $hostsq->execute(@fj); + my $hosts = $hostsq->fetchall_arrayref({ }); + + my $record_phase = sub { + my ($start,$finish,@xkvs) = @_; + $finish = $start if $finish < $start; # wtf + foreach my $hostrow (@$hosts) { + my $hn = $hostrow->{val}; + print DEBUG " phase $hn $start..$finish @kvs @xkvs\n"; + push @{ $hh{$hn} }, { + From => $start, + To => $finish, + KV => { @kvs, @xkvs, host_fixed => !$hostrow->{synth} }, + }; + } + }; + + $prepq->execute(@fj); + my $preprow = $prepq->fetchrow_hashref(); + if (defined $preprow) { + push @kvs, %$preprow; + if ((defined $preprow->{prep_status}) && + $preprow->{prep_status} eq 'pass') { + $record_phase->($jobrow->{alloc_finished}, + $preprow->{prep_finished}, + 'PREP' => 1, + 'SHAREABLE' => 0); + $record_phase->($preprow->{prep_finished}, + $finish, + 'PREP' => 0, + 'SHAREABLE' => 1); + } else { + # there was a prep attempt but it didn't pass + $record_phase->($jobrow->{alloc_finished}, + $finish, + 'PREP' => 1, + 'SHAREABLE' => 0); + } + } else { + # something strange, well, fine + $record_phase->($jobrow->{alloc_finished}, + $finish, + PREP => 0, + SHAREABLE => 0); + } + } +} + +sub consolidate_host ($) { + my ($hostname) = @_; + + progress1 "host $hostname"; + + $propq->execute($hostname, 'shared max tasks'); + my ($max_shares) = $propq->fetchrow_array(); + $max_shares ||= 3; + + print DEBUG "host $hostname max_shares=$max_shares\n"; + + print DEBUG "host $hostname sorting\n"; + + my @sorted = sort { $a->{From} <=> $b->{From} } @{ $hh{$hostname} }; + my @out; + $hh{$hostname} = \@out; + + print DEBUG "host $hostname chopping\n"; + + while (@sorted) { + my $subphase_start = $sorted[0]{From}; + my $subphase_end = $sorted[0]{To}; + + # We compute the next subphase period, and how many of the + # incoming phases overlap with it. + # + # There are one or more phases which start at $subphase_start. + # It is exactly these phases which occur in the subphase. + # + # The subphase ends when either: one of those subphases ends, + # or a subsequent subphase begins + + # We figure out when the next subphase + + my $eat_phases = 0; + my $next_event = $subphase_end; + + for (my $i=0; $i<@sorted; $i++) { + my $cand_phase = $sorted[$i]; + + last if $cand_phase->{From} > $subphase_end; + # ... we are well beyond the subphase then + + if ($cand_phase->{From} == $subphase_start) { + $eat_phases++; + $next_event = $cand_phase->{To}; + } else { + $cand_phase->{From} > $subphase_start or die; + $next_event = $cand_phase->{From}; + } + $subphase_end = $next_event if $next_event < $subphase_end; + } + + progress sprintf "subphase %-20s %15d %15d %3d", + $hostname, $subphase_start, $subphase_end, $eat_phases; + + my @secondhalves; + my @subphases; + for (my $i=0; $i<$eat_phases; $i++) { + my $eating = shift @sorted; + die unless $eating->{From} == $subphase_start; + die if $eating->{To} < $subphase_end; + if ($eating->{To} > $subphase_end) { + # Each of the incoming phases which start at the + # subphase period and finish after its end is broken + # up into two new phases: one which goes into the + # output. + push @secondhalves, { + From => $subphase_end, + To => $eating->{To}, + KV => { %{ $eating->{KV} } }, + }; + $eating->{To} = $subphase_end; + } + push @subphases, $eating; + } + unshift @sorted, @secondhalves; + + # See if we are sharing, and if so calculate the sharing + # fraction and also perhaps invent an idle share. We do this + # here so that we are editing in @out. Editing in @sorted + # would be wrong because it would affect other subphases. + + my $all_shares = 1; + my $max_shares_now = 1; + foreach my $sp (@subphases) { + $all_shares &&= $sp->{KV}{SHAREABLE}; + if (defined $sp->{KV}{job} && + $sp->{KV}{job} =~ m/^build/) { + $max_shares_now = $max_shares; + } + } + my @sp0kvs = %{ $subphases[0]{KV} }; + + if ($all_shares) { + if (@subphases > $max_shares_now) { + progress1 ''; + print STDERR "warning: $hostname". + " $subphase_start..$subphase_end:". + " msn=$max_shares_now != ".(scalar @subphases)."\n"; + $max_shares_now = @subphases; + } + + foreach my $sp (@subphases) { + $sp->{KV}{SHARES} = $max_shares_now; + } + + while (@subphases < $max_shares_now) { + push @subphases, { + From => $subphase_start, + To => $subphase_end, + KV => { @sp0kvs, SHARES => $max_shares_now, IDLE => 1 }, + }; + } + } + + my $next_phase = $sorted[0]; + if ($next_phase && + $next_phase->{From} != $subphase_end) { + # Need to add an idle phase, to bridge to next incoming + # phase. + die unless $next_phase->{From} > $subphase_end; + push @subphases, { + From => $subphase_end, + To => $next_phase->{From}, + KV => $all_shares ? { @sp0kvs, IDLE => 1 } : { IDLE => 1 }, + }; + } + + foreach my $sp (@subphases) { + my $kv = $sp->{KV}; + my $jk = ( + !defined $kv->{job} ? '' : + $kv->{job} =~ m/^build/ ? 'BUILD' : + 'TEST' + ); + $kv->{OVERALL} = + ( $kv->{IDLE} ? ( $kv->{SHARES} ? "IDLE-SHARE-$jk" : + $kv->{SHAREABLE} ? "IDLE-PREPPED-$jk" : + "IDLE" ) : + $kv->{PREP} ? "PREP-$jk" : + "$jk" + ); + + $kv->{WEIGHT} = + 1.0 / ( $kv->{SHARES} // 1.0 ); + } + + foreach my $sp (@subphases) { + my @kvs = map { "$_=$sp->{KV}{$_}" } sort keys %{ $sp->{KV} }; + my $t = $sp->{To} - $sp->{From}; + printf DEBUG " SP %s %5d %s..%s %skvs\n", + $hostname, $t, $sp->{From}, $sp->{To}, "@kvs"; + $sp->{From} = $cutoff_start if $sp->{From} < $cutoff_start; + $sp->{To} = $cutoff_end if $sp->{To} > $cutoff_end; + next unless $sp->{From} < $sp->{To}; + push @out, $sp; + } + } + progress1 ''; +} + +sub output_host ($) { + my ($hn) = @_; + + my $hostflagsq = db_prepare(<<END); + SELECT hostflag f + FROM hostflags + WHERE hostname = ? +END + + my %hinfo; + $hostflagsq->execute($hn); + while (my ($f) = $hostflagsq->fetchrow_array()) { + if ($f =~ m/^blessed-real$/) { + $hinfo{'HOST_BLESSED_REAL'} = 1; + } elsif ($f =~ m/^arch-(?:amd64|i386)$/) { + $hinfo{'HOST_ARCH_GROUP'} = 'x86'; + } elsif ($f =~ m/^arch-arm/) { + $hinfo{'HOST_ARCH_GROUP'} = 'arm'; + } + } + + my $hd = $hh{$hn}; + foreach my $e (@$hd) { + my $duration = $e->{To} - $e->{From}; + my $obj = { %{ $e->{KV} }, %hinfo }; + delete $obj->{$_} foreach qw(flight alloc_finished prep_finished); + $obj->{HOSTNAME} = $hn; + $obj->{DURATION} = $duration; + $obj->{WDURATION} = $obj->{WEIGHT} * $obj->{DURATION}; + print encode_json($obj),"\n" or die $!; + } +} + +collectdata(); + +foreach my $h (sort keys %hh) { +# print DEBUG "\n-------------------- $h --------------------\n"; +# print DEBUG "\n",Dumper($hh{$h}); + consolidate_host($h); +# print DEBUG "\n",Dumper($hh{$h}); + output_host($h); +}
mg-report-host-usage-tuples new file +124 -0
124 lines not on this page · raw message
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Ian Jackson writes ("[Wg-test-framework] osstest Massachusetts test lab resource usage investigation"):
Quoted 5 lines
In parallel with the work I am reporting in this email, I am already taking steps to investigate the performance of the various database queries, and the situation with locking.
I hope that this will produce actionable ideas for improvement.
I have now completed the investigation into db queries. The patch for the code I used is below. The output (for data collected for the past few days, which I expect to be fairly representative) is here:
http://xenbits.xen.org/people/iwj/2016/mg-db-activity.2016-08-30.txt
Best to download it and view it in less -S. Again, interpreting these numbers will depend on reading the source code to see what the various categories mean. I didn't bother with charts because there are many fewer degrees of freedom here.
The bulk of the delay is caused by connections which have done LOCK TABLE but are now doing some processing in the client. Originally, this was necessary because the version of Postgres we were using didn't support predicate locking; so we would simply lock all the relevant tables and not rely on database concurrency. But Postgres 9.x does support predicate locking.
Over the past year or so I have done some work to make the code handle database-condurrency-induced transaction failure. This has been lightly tested. I think it is probably time now to take out the LOCK TABLE instructions (and deal with any resulting fallout).
Other notable long-running transactions include:
* The sg-check-tested invocation in cr-daily-branch near line 113 ($equivstatusq) which checks whether the baseline revision has been tested. This could probably be speeded up with an appropriate index, but it is not particularly critical because it's readonly and not on a hugely critical path: it runs during flight construction with no locks held other than the table locks (see above - these are removeable) and the per-`branch' lock. [1253]
* The `equivalent hosts' query in ts-hosts-allocate-Executive, near line line 303. I think this query could be optimised. This is a fairly significant contributor to overall delays, and it runs in a critical path in the host allocator. It compares unfavourably to the query which extracts information about the very same host ($recentflights_q in Osstest::Executive::duration_estimator), which is responsible for a fraction of the query time despite being having more complex conditions. I think this query may be being misoptimised and some experimentation would be valuable. [880]
* Next are the three duration estimator / host allocator queries $recentflights_q, $duration_anyref_q and $duration_duration_q, which are again on the critical path in the host allocator. These are necessarily a bit slow because they do quite a bit of archaeology. Rather than trying to optimise them, it would probably be worth thinking how to get them off the host allocator critical path. [196+187+90]
Techniques that come to mind would be memoising the information (and perhaps updating it with a search of recently completed flights), or pre-calculating it so that it runs outside the host allocator job slot (which would, in effect, parallelise the different jobs' executions of instances of this query).
Getting into the log tail here:
* sg-report-job's query for build jobs (ie, looking for other jobs to recurse to to calculate the revisions used). [61] Not worth doing anything about.
* cs-bisection-step's attempt to find a build job to reuse ($reusejob). Maybe some of the indices would help, but this one isn't critical. [44]
Ian.
From 68e36d6d265e25bae0d4c2c239d11870b856609e Mon Sep 17 00:00:00 2001
From: Ian Jackson <[email protected]>
Date: Tue, 30 Aug 2016 10:58:50 +0100
Subject: [OSSTEST PATCH] mg-db-activity-*: New admin debugging tools for DB
queries
mg-db-activity-logger can be used to sample the activity in the database, for consumption by mg-db-activity-redactor.
This can be used to look for long-running db queries and to investigate lock contention.
--- mg-db-activity-logger | 98 +++++++++++++++++++ mg-db-activity-redactor | 245 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 343 insertions(+) create mode 100755 mg-db-activity-logger create mode 100755 mg-db-activity-redactor
mg-db-activity-logger new file +98 -0
@@ -0,0 +1,98 @@ +#!/usr/bin/perl -w + +# Needs to be able to connect as the db superuser. +# +# So probably has to run as user `postgres'. + +use strict; +use DBI; +use Data::Dumper; + +BEGIN { +unshift @INC, "$`" if $0 =~ m#/[^/]+$#; +} + +use Osstest; + +our $dbname = 'osstestdb'; +our $interval = 60; + +while (@ARGV && $ARGV[0] =~ m/^-/) { + $_ = shift @ARGV; + last if m/^--?$/; + while (m/^-./) { + if (s/^--db=(.+)$//) { + $dbname = $1; + } elsif (s/^-t=(\d+)$/-/) { + $interval = $1; + } else { + die "$_ ?"; + } + } +} + +die unless @ARGV == 1; +our ($outfn) = @ARGV; + +our $idbh = DBI->connect("dbi:Pg:dbname=$dbname",'','', + { RaiseError => 1, PrintError => 1 }); + +my @tsfields = qw(backend_start xact_start query_start); + +my $iq_tsfields = join ', ', map { + "extract(epoch from a.$_) as osstest_${_}"; +} @tsfields; + +my $iquery = $idbh->prepare(<<END); + SELECT *, $iq_tsfields + FROM pg_locks l + FULL JOIN pg_stat_activity a + ON l.pid = a.procpid +END + +my $odbh = DBI->connect("dbi:SQLite:dbname=$outfn",'','', + { RaiseError => 1, PrintError => 1 }); + + +my $oquery; + +our $mktable_done; + +sub mktable () { + my $cstmt = "CREATE TABLE IF NOT EXISTS datapoints (\n". + " osstest_timestamp INTEGER NOT NULL"; + my $ostmt = "INSERT INTO datapoints VALUES (?"; + my $fields = $iquery->{NAME}; + foreach my $f (@$fields) { + $cstmt .= sprintf ",\n %-30s TEXT", $f; + $ostmt .= ",?"; + } + $cstmt .= "\n)"; + $ostmt .= ");"; + $odbh->do($cstmt); + $oquery = $odbh->prepare($ostmt); +} + +for (;;) { + $odbh->begin_work; + + my $now = time; + + $iquery->execute(); + my $dp = $iquery->fetchall_arrayref(); + + if (!$mktable_done) { + mktable(); + $mktable_done = 1; + } + + foreach my $row (@$dp) { + $oquery->execute($now, @$row); + } + + $odbh->commit; + + printf "%s: %d rows\n", (show_abs_time $now), (scalar @$dp); + + sleep $interval; +}
mg-db-activity-redactor new file +245 -0
245 lines not on this page · raw message
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Ian Jackson writes ("Re: [Wg-test-framework] osstest Massachusetts test lab resource usage investigation"):
Quoted 1 line
I have now completed the investigation into db queries.
I've been looking at the bisector too. I captured a history snapshot containing two bisections chosen arbitrarily, and wrote some scripts which I used to analyse the snapshot.
Xen 4.5 build failure around 20th of September.
The bisector completed bisections of both the amd64 and i386 build failures, in that order. Here is the top time spent for amd64:
68.69% 41208 flight - step start build hosts-allocate | flight - step finish build
10.96% 6577 flight - step start build host-install(3) | flight - step finish build 10.53% 6316 flight - step start build .*-build | flight - step finish build 5.42% 3249 flight - step start build host-(?:install|build-prep) | flight - step finish build
0.76% 453 email - testing | flight - job start
And for i386:
49.22% 8976 flight - step start build hosts-allocate | flight - step finish build 19.51% 3557 flight - step start build .*-build | flight - step finish build 13.10% 2389 flight - step start build host-install(3) | flight - step finish build 5.49% 1002 flight - step start build host-(?:install|build-prep) | flight - step finish build
2.24% 409 flight - flight ending | mtime - transcript
Overall it spent 50-70% of the elapsed time waiting for a slot on a build machine, and then 16-20% of the elapsed time reinstalling the build machine.
I think this could be improved by providing one or more hosts which were dedicated to building. They would not need reinstalling so often, and would often be idle.
Looking at the logs there is a particularly long delay (15ks, 4h12) before the first repro job completes. I think this is probably because each bisection job runs with the start time priority of the first one, so that the first job is delayed by (roughly) the queue length. This is done deliberately to avoid trying to bisect things which are fixed quickly. Given the small proportion of our resources being used for bisections we may want to reconsider that.
Xen 4.5 guest migration failure around 22nd September. (test-amd64-amd64-xl-qemuu-winxpsp3, step guest-localmigrate/x10.
The bisector ran first for a different failure, test-amd64-amd64-xl-qemuu-ovmf-amd64 and determined that that one was unreproducible.
I have analysed data only up to Thu, 22 Sep 2016 07:59:02 GMT (since that was in my collection snapshot).
Counting the whole period from the failure of the main flight to the end of the snapshot recording, we have the following elapsed times:
35.05% 23613 flight - step start build hosts-allocate | flight - step finish build
18.85% 12698 flight - step start test hosts-allocate | flight - step finish test
14.79% 9965 flight - step start test windows-install | flight - step finish test
These figures will disproportionately bias the initial startup host allocation delay (see above), since this is not a finished bisection.
Counting only the period after the ovmf bisection was abandoned,
37.11% 9965 flight - step start test windows-install | flight - step finish test 10.97% 2946 flight - step start test hosts-allocate | flight - step finish test 8.13% 2183 flight - step start test host-install(3) | flight - step finish test 7.05% 1892 flight - step start test (?!capture|host-install|hosts-allocate|windows-install).* | flight - step finish test 6.32% 1697 flight - step start build .*-build | flight - step finish build 6.15% 1650 flight - step start build host-install(3) | flight - step finish build 5.47% 1470 mtime - bisection-report | mtime - transcript 4.54% 1220 crlog - begin | email - testing
3.42% 918 flight - step start build host-(?:install|build-prep) | flight - step finish build
1.75% 470 flight - job finish | flight - step finish build
Looking at the logs each iteration takes about 1 hour.
This bisection involves a much longer iteration for each step, because the test involves a Windows install. So the host allocation delay here is a much smaller proportion, even though the bisector needs to get exactly the right host.
11% is not that much here, but a faster test would make this look worse. I have a half-baked idea to allow an in-progress bisection to reserve its test host. I think that this would be worth pursuing, although there's a fair amount of complication involved.
38% of the wall clock time was spent doing a Windows install. The test does a fresh install each time, rather than saving a VM image and reusing it.
In principle it might be possible to use saved VM images. We do fresh installs because installs are a good exercise of a variety of functionality, and because that avoids having to maintain and comprehend a library of VMs. In particular: if we were maintaining a library of VMs they would have to be updated occasionally (when), and problems which arose due to changes in the VM library would be obscure. I don't think changes in this area are particularly easy.
Windows installs are a pathological case because they are so slow. Most guest installs done by osstest are much faster. And when there seem to be multiple regressions, osstest choses to work first on the one whose test is shortest - hence picking an Debian install on OVMF first, here.
About 15% of the time (depending how you count it) seems to be going on bookkeeping of one kind or another, including the archaelogy necessary to decide what the next revision to test is. In a faster test this would be quite a large proportion of the elapsed time. My other reports, particularly the one one on database transaction performance, contain some suggestions on how this might be improved.
In general I think the database concurrency issues I discussed in my
email
Subject: Re: [Wg-test-framework] osstest Massachusetts test lab resource usage investigation
Date: Tue, 30 Aug 2016 11:53:18 +0100
will help with this.
I expect many developers will think that osstest's bisector is spending far too much time on setup, during each bisection iteration. It's always wiping a host, reinstalling with the relevant Xen, and (if the failure is not before then) reinstalling the guest OS.
But of course a human is likely to be able to tell whether a particular issue could have been the result of (for example) corruption which occurred during the install phase. It's also possible for bugs to even cause disk corruption on the host.
To avoid giving wrong answers it seems best to me for the osstest bisector to use a strategy which is somewhat slower but which is sure not to be misled.
I will send my scripts as a followup to this email.
Ian.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
PATCH 1/3 Add *.tmp to .gitignore
In reply to Ian Jackson--- .gitignore | 1 + 1 file changed, 1 insertion(+)
.gitignore +1 -0
@@ -1,6 +1,7 @@ *~ *.bak tmp +*.tmp bisection.ps bisection.dot bisection.html
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH 2/3 mg-bisect-activity-*: New rather ad-hoc scripts for wall clock timing analysys
In reply to Ian Jackson--- .gitignore | 2 + README.bisect-wallclock-analysis | 85 ++++++++++++++++++ mg-bisect-activity-collect-emails | 55 ++++++++++++ mg-bisect-activity-collect-tmpdir | 94 ++++++++++++++++++++ mg-bisect-activity-create-db | 17 ++++ mg-bisect-activity-dump-periods | 181 ++++++++++++++++++++++++++++++++++++++ 6 files changed, 434 insertions(+) create mode 100644 README.bisect-wallclock-analysis create mode 100755 mg-bisect-activity-collect-emails create mode 100755 mg-bisect-activity-collect-tmpdir create mode 100755 mg-bisect-activity-create-db create mode 100755 mg-bisect-activity-dump-periods
.gitignore +2 -0
@@ -33,3 +33,5 @@ images diskusage-[A-Z]*.html diskusage-[A-Z]*.png diskusage-[A-Z]*.pdf +bisect-timing.db +*.tmp
README.bisect-wallclock-analysis new file +85 -0
85 lines not on this page · raw message
mg-bisect-activity-collect-emails new file +55 -0
55 lines not on this page · raw message
mg-bisect-activity-collect-tmpdir new file +94 -0
94 lines not on this page · raw message
mg-bisect-activity-create-db new file +17 -0
@@ -0,0 +1,17 @@ +#!/bin/bash +set -e +set -o pipefail +set -o posix + +# usage: ./mg-bisect-activity-create-db +# overwrites bisect-timing.db unconditionally + +rm -f bisect-timing.db +sqlite3 bisect-timing.db -batch </dev/null -cmd ' + CREATE TABLE events ( + ts INTEGER NOT NULL, + cat TEXT NOT NULL, + evt TEXT NOT NULL + ); + CREATE INDEX events_ts_ix ON events (ts); +'
mg-bisect-activity-dump-periods new file +181 -0
181 lines not on this page · raw message
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH 3/3 mg-bisect-activity-dump-periods: Split out windows-install steps
In reply to Ian Jackson--- mg-bisect-activity-dump-periods | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mg-bisect-activity-dump-periods +1 -1
@@ -178,4 +178,4 @@ email - complete | crlog - end flight - step start build host-(?:install|build-prep) flight - step start build .*-build flight - step start test capture-logs.* -flight - step start test (?!capture|host-install|hosts-allocate).* +flight - step start test (?!capture|host-install|hosts-allocate|windows-install).*
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel