github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/pkg/cmd/roachtest/ledger.go (about)

     1  // Copyright 2018 The Cockroach Authors.
     2  //
     3  // Use of this software is governed by the Business Source License
     4  // included in the file licenses/BSL.txt.
     5  //
     6  // As of the Change Date specified in that file, in accordance with
     7  // the Business Source License, use of this software will be governed
     8  // by the Apache License, Version 2.0, included in the file
     9  // licenses/APL.txt.
    10  
    11  package main
    12  
    13  import (
    14  	"context"
    15  	"fmt"
    16  )
    17  
    18  func registerLedger(r *testRegistry) {
    19  	const nodes = 6
    20  	const azs = "us-central1-a,us-central1-b,us-central1-c"
    21  	r.Add(testSpec{
    22  		Name:    fmt.Sprintf("ledger/nodes=%d/multi-az", nodes),
    23  		Owner:   OwnerKV,
    24  		Cluster: makeClusterSpec(nodes+1, cpu(16), geo(), zones(azs)),
    25  		Run: func(ctx context.Context, t *test, c *cluster) {
    26  			roachNodes := c.Range(1, nodes)
    27  			gatewayNodes := c.Range(1, nodes/3)
    28  			loadNode := c.Node(nodes + 1)
    29  
    30  			c.Put(ctx, cockroach, "./cockroach", roachNodes)
    31  			c.Put(ctx, workload, "./workload", loadNode)
    32  			c.Start(ctx, t, roachNodes)
    33  
    34  			t.Status("running workload")
    35  			m := newMonitor(ctx, c, roachNodes)
    36  			m.Go(func(ctx context.Context) error {
    37  				concurrency := ifLocal("", " --concurrency="+fmt.Sprint(nodes*32))
    38  				duration := " --duration=" + ifLocal("10s", "10m")
    39  
    40  				cmd := fmt.Sprintf("./workload run ledger --init --histograms="+perfArtifactsDir+"/stats.json"+
    41  					concurrency+duration+" {pgurl%s}", gatewayNodes)
    42  				c.Run(ctx, loadNode, cmd)
    43  				return nil
    44  			})
    45  			m.Wait()
    46  		},
    47  	})
    48  }