[ARVADOS] updated: 1.1.4-10-g4d93904

Git user git at public.curoverse.com
Thu Apr 26 13:12:34 EDT 2018


Summary of changes:
 services/keep-balance/balance.go      | 10 +++++++---
 services/keep-balance/balance_test.go |  2 +-
 services/keep-balance/block_state.go  |  8 ++++++++
 3 files changed, 16 insertions(+), 4 deletions(-)

       via  4d93904f55dbd8e85cf44b1ea80d1d0ec81ccfe1 (commit)
       via  32607b54f1fb17420b35616e3461ff5052f91194 (commit)
      from  3ce3d9f884aed70cc84155554defe614a1bcfaaa (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 4d93904f55dbd8e85cf44b1ea80d1d0ec81ccfe1
Author: Tom Clegg <tclegg at veritasgenetics.com>
Date:   Thu Apr 26 13:10:04 2018 -0400

    12708: TODO notes about memory use and class combinations.
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tclegg at veritasgenetics.com>

diff --git a/services/keep-balance/block_state.go b/services/keep-balance/block_state.go
index 6fd50f4..22e89c0 100644
--- a/services/keep-balance/block_state.go
+++ b/services/keep-balance/block_state.go
@@ -25,6 +25,14 @@ type Replica struct {
 type BlockState struct {
 	Replicas []Replica
 	Desired  map[string]int
+	// TODO: Support combinations of classes ("private + durable")
+	// by replacing the map[string]int with a map[*[]string]int
+	// here, where the map keys come from a pool of semantically
+	// distinct class combinations.
+	//
+	// TODO: Use a pool of semantically distinct Desired maps to
+	// conserve memory (typically there are far more BlockState
+	// objects in memory than distinct Desired profiles).
 }
 
 var defaultClasses = []string{"default"}

commit 32607b54f1fb17420b35616e3461ff5052f91194
Author: Tom Clegg <tclegg at veritasgenetics.com>
Date:   Thu Apr 26 13:09:29 2018 -0400

    12708: Precompute len(slots) to reduce mallocs. Rename setupCaches.
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tclegg at veritasgenetics.com>

diff --git a/services/keep-balance/balance.go b/services/keep-balance/balance.go
index 7ad2d48..5359bc1 100644
--- a/services/keep-balance/balance.go
+++ b/services/keep-balance/balance.go
@@ -51,6 +51,7 @@ type Balancer struct {
 	MinMtime           int64
 
 	classes       []string
+	mounts        int
 	mountsByClass map[string]map[*KeepMount]bool
 	collScanned   int
 	serviceRoots  map[string]string
@@ -358,7 +359,7 @@ func (bal *Balancer) ComputeChangeSets() {
 	// This just calls balanceBlock() once for each block, using a
 	// pool of worker goroutines.
 	defer timeMe(bal.Logger, "ComputeChangeSets")()
-	bal.setupCaches()
+	bal.setupLookupTables()
 
 	type balanceTask struct {
 		blkid arvados.SizedDigest
@@ -391,13 +392,16 @@ func (bal *Balancer) ComputeChangeSets() {
 	bal.collectStatistics(results)
 }
 
-func (bal *Balancer) setupCaches() {
+func (bal *Balancer) setupLookupTables() {
 	bal.serviceRoots = make(map[string]string)
 	bal.classes = []string{"default"}
 	bal.mountsByClass = map[string]map[*KeepMount]bool{"default": {}}
+	bal.mounts = 0
 	for _, srv := range bal.KeepServices {
 		bal.serviceRoots[srv.UUID] = srv.UUID
 		for _, mnt := range srv.mounts {
+			bal.mounts++
+
 			// All mounts on a read-only service are
 			// effectively read-only.
 			mnt.ReadOnly = mnt.ReadOnly || srv.ReadOnly
@@ -457,7 +461,7 @@ func (bal *Balancer) balanceBlock(blkid arvados.SizedDigest, blk *BlockState) ba
 	}
 
 	// Build a list of all slots (one per mounted volume).
-	var slots []slot
+	slots := make([]slot, 0, bal.mounts)
 	for _, srv := range bal.KeepServices {
 		for _, mnt := range srv.mounts {
 			var repl *Replica
diff --git a/services/keep-balance/balance_test.go b/services/keep-balance/balance_test.go
index 4741a58..cfdd47f 100644
--- a/services/keep-balance/balance_test.go
+++ b/services/keep-balance/balance_test.go
@@ -362,7 +362,7 @@ func (bal *balancerSuite) TestChangeStorageClasses(c *check.C) {
 // the appropriate changes for that block have been added to the
 // changesets.
 func (bal *balancerSuite) try(c *check.C, t tester) {
-	bal.setupCaches()
+	bal.setupLookupTables()
 	blk := &BlockState{
 		Replicas: bal.replList(t.known, t.current),
 		Desired:  t.desired,

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list