[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[OSSTEST PATCH 6/7] host allocation: Memoise $equivstatus query results


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
  • Date: Wed, 19 Aug 2020 17:01:42 +0100
  • Authentication-results: esa4.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none
  • Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
  • Delivery-date: Wed, 19 Aug 2020 16:01:59 +0000
  • Ironport-sdr: KCXr+Q+fHp8u1JDcNlXp7WyrcfoYrQp6twSLPRGRXZbUC9I/8pQfNcjFO2LNpfY69QZQCk4uD8 iM34qNNEXVtiIqwX1ZX2FzC4hJviphnEkoJRps+S5b55BCOaYZup68ZyoEzpIi99pMGBBQvQJ2 lhgdZmkWpYnBV05m7zNbAyewOMO9hyvvsaVmqEUX+h4nhzvRt8tCOjprylplKwQ4/Q+MnM6FSp s01neUlnJvVjlKiYmr8cmQJiF9KkwQjX1qMAAMgcen1X+L0hVBI9nuqCct7YrwFE5JTN/ywkOf R/4=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

This provides a very significant speedup.

Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 ts-hosts-allocate-Executive | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/ts-hosts-allocate-Executive b/ts-hosts-allocate-Executive
index 39c66346..a47bc499 100755
--- a/ts-hosts-allocate-Executive
+++ b/ts-hosts-allocate-Executive
@@ -467,9 +467,13 @@ END
         find_recent_duration($dbg,$hid,$candrow);
 
        if ($candrow->{restype} eq 'host') {
-           $equivstatusq->execute($job,$blessing,$fi->{branch},
-                                  $hid->{Ident},$candrow->{resname});
-           my $esrow = $equivstatusq->fetchrow_hashref();
+           our %equivstatus_memo;
+           my @params = ($job,$blessing,$fi->{branch},
+                         $hid->{Ident},$candrow->{resname});
+           my $esrow = $equivstatus_memo{"@params"} //= do {
+               $equivstatusq->execute(@params);
+               $equivstatusq->fetchrow_hashref() // { };
+           };
            $candrow->{EquivMostRecentStatus} = $esrow->{status};
            print DEBUG "$dbg EQUIV-MOST-RECENT ";
            print DEBUG ("$esrow->{flight}.$esrow->{job}".
-- 
2.11.0




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.