Skip to content

Commit

Permalink
vtgateproxy: sticky random balancer and remote zone backup connections (
Browse files Browse the repository at this point in the history
#593)

* gist of the idea of a sticky_random balancer

* make sticky_random actually work

* include the zone locality in the address attributes

Make it available to the picker layer along with the pool type. Also rework how
the locality is computed to do it as part of building the target host rather
than deferring the comparisons to the sorter.

* include IsLocal in debug output

* add support for local zone affinity to sticky_random

Using the zone local attribute inhjected by discovery (if it exists), update
sticky_random so that it biases to only use the local zone connections if there
are any available, otherwise fall back to remote.

* add num_backup_conns option to force discovery of non-zone-local vtgates
  • Loading branch information
demmer authored and dedelala committed Feb 5, 2025
1 parent 94c7f03 commit fe69140
Show file tree
Hide file tree
Showing 6 changed files with 258 additions and 16 deletions.
44 changes: 30 additions & 14 deletions go/vt/vtgateproxy/discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ import (
//

const PoolTypeAttr = "PoolType"
const ZoneLocalAttr = "ZoneLocal"

// Resolver(https://godoc.org/google.golang.org/grpc/resolver#Resolver).
type JSONGateResolver struct {
Expand All @@ -83,6 +84,7 @@ type JSONGateResolverBuilder struct {
affinityField string
affinityValue string
numConnections int
numBackupConns int

mu sync.RWMutex
targets map[string][]targetHost
Expand All @@ -98,6 +100,7 @@ type targetHost struct {
Addr string
PoolType string
Affinity string
IsLocal bool
}

var (
Expand All @@ -113,6 +116,7 @@ func RegisterJSONGateResolver(
affinityField string,
affinityValue string,
numConnections int,
numBackupConns int,
) (*JSONGateResolverBuilder, error) {
jsonDiscovery := &JSONGateResolverBuilder{
targets: map[string][]targetHost{},
Expand All @@ -123,6 +127,7 @@ func RegisterJSONGateResolver(
affinityField: affinityField,
affinityValue: affinityValue,
numConnections: numConnections,
numBackupConns: numBackupConns,
sorter: newShuffleSorter(),
}

Expand Down Expand Up @@ -263,7 +268,7 @@ func (b *JSONGateResolverBuilder) parse() (bool, error) {
return false, fmt.Errorf("error parsing JSON discovery file %s: %v", b.jsonPath, err)
}

var targets = map[string][]targetHost{}
var allTargets = map[string][]targetHost{}
for _, host := range hosts {
hostname, hasHostname := host["host"]
address, hasAddress := host[b.addressField]
Expand Down Expand Up @@ -309,8 +314,8 @@ func (b *JSONGateResolverBuilder) parse() (bool, error) {
return false, fmt.Errorf("error parsing JSON discovery file %s: port field %s has invalid value %v", b.jsonPath, b.portField, port)
}

target := targetHost{hostname.(string), fmt.Sprintf("%s:%s", address, port), poolType.(string), affinity.(string)}
targets[target.PoolType] = append(targets[target.PoolType], target)
target := targetHost{hostname.(string), fmt.Sprintf("%s:%s", address, port), poolType.(string), affinity.(string), affinity == b.affinityValue}
allTargets[target.PoolType] = append(allTargets[target.PoolType], target)
}

// If a pool disappears, the metric will not record this unless all counts
Expand All @@ -320,16 +325,25 @@ func (b *JSONGateResolverBuilder) parse() (bool, error) {
// targets and only resetting pools which disappear.
targetCount.ResetAll()

for poolType := range targets {
b.sorter.shuffleSort(targets[poolType], b.affinityField, b.affinityValue)
if len(targets[poolType]) > *numConnections {
targets[poolType] = targets[poolType][:b.numConnections]
var selected = map[string][]targetHost{}

for poolType := range allTargets {
b.sorter.shuffleSort(allTargets[poolType])

// try to pick numConnections from the front of the list (local zone) and numBackupConnections
// from the tail (remote zone). if that's not possible, just take the whole set
if len(allTargets[poolType]) >= b.numConnections+b.numBackupConns {
remoteOffset := len(allTargets[poolType]) - b.numBackupConns
selected[poolType] = append(allTargets[poolType][:b.numConnections], allTargets[poolType][remoteOffset:]...)
} else {
selected[poolType] = allTargets[poolType]
}
targetCount.Set(poolType, int64(len(targets[poolType])))

targetCount.Set(poolType, int64(len(selected[poolType])))
}

b.mu.Lock()
b.targets = targets
b.targets = selected
b.mu.Unlock()

return true, nil
Expand All @@ -353,7 +367,7 @@ func (b *JSONGateResolverBuilder) getTargets(poolType string) []targetHost {
targets = append(targets, b.targets[poolType]...)
b.mu.RUnlock()

b.sorter.shuffleSort(targets, b.affinityField, b.affinityValue)
b.sorter.shuffleSort(targets)

return targets
}
Expand All @@ -373,7 +387,7 @@ func newShuffleSorter() *shuffleSorter {
// shuffleSort shuffles a slice of targetHost to ensure every host has a
// different order to iterate through, putting the affinity matching (e.g. same
// az) hosts at the front and the non-matching ones at the end.
func (s *shuffleSorter) shuffleSort(targets []targetHost, affinityField, affinityValue string) {
func (s *shuffleSorter) shuffleSort(targets []targetHost) {
n := len(targets)
head := 0
// Only need to do n-1 swaps since the last host is always in the right place.
Expand All @@ -383,7 +397,7 @@ func (s *shuffleSorter) shuffleSort(targets []targetHost, affinityField, affinit
j := head + s.rand.Intn(tail-head+1)
s.mu.Unlock()

if affinityField != "" && affinityValue == targets[j].Affinity {
if targets[j].IsLocal {
targets[head], targets[j] = targets[j], targets[head]
head++
} else {
Expand All @@ -406,7 +420,8 @@ func (b *JSONGateResolverBuilder) update(r *JSONGateResolver) error {

var addrs []resolver.Address
for _, target := range targets {
addrs = append(addrs, resolver.Address{Addr: target.Addr, Attributes: attributes.New(PoolTypeAttr, r.poolType)})
attrs := attributes.New(PoolTypeAttr, r.poolType).WithValue(ZoneLocalAttr, target.IsLocal)
addrs = append(addrs, resolver.Address{Addr: target.Addr, Attributes: attrs})
}

// If we've already selected some targets, give the new addresses some time to warm up before removing
Expand Down Expand Up @@ -488,12 +503,13 @@ const (
</style>
<table>
{{range $i, $p := .Pools}} <tr>
<th colspan="3">{{$p}}</th>
<th colspan="4">{{$p}}</th>
</tr>
{{range index $.Targets $p}} <tr>
<td>{{.Hostname}}</td>
<td>{{.Addr}}</td>
<td>{{.Affinity}}</td>
<td>{{.IsLocal}}</td>
</tr>{{end}}
{{end}}
</table>
Expand Down
5 changes: 3 additions & 2 deletions go/vt/vtgateproxy/firstready_balancer.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,13 @@ import (
)

// newBuilder creates a new first_ready balancer builder.
func newBuilder() balancer.Builder {
func newFirstReadyBuilder() balancer.Builder {
return base.NewBalancerBuilder("first_ready", &frPickerBuilder{currentConns: map[string]balancer.SubConn{}}, base.Config{HealthCheck: true})
}

func init() {
balancer.Register(newBuilder())
log.V(1).Infof("registering first_ready balancer")
balancer.Register(newFirstReadyBuilder())
}

// frPickerBuilder implements both the Builder and the Picker interfaces.
Expand Down
11 changes: 11 additions & 0 deletions go/vt/vtgateproxy/mysql_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,8 @@ func (ph *proxyHandler) ComQuery(c *mysql.Conn, query string, callback func(*sql
}
}()

ctx = context.WithValue(ctx, CONN_ID_KEY, int(c.ConnectionID))

if session.SessionPb().Options.Workload == querypb.ExecuteOptions_OLAP {
err := ph.proxy.StreamExecute(ctx, session, query, make(map[string]*querypb.BindVariable), callback)
return sqlerror.NewSQLErrorFromError(err)
Expand Down Expand Up @@ -285,6 +287,8 @@ func (ph *proxyHandler) ComPrepare(c *mysql.Conn, query string, bindVars map[str
}
}(session)

ctx = context.WithValue(ctx, CONN_ID_KEY, int(c.ConnectionID))

_, fld, err := ph.proxy.Prepare(ctx, session, query, bindVars)
err = sqlerror.NewSQLErrorFromError(err)
if err != nil {
Expand Down Expand Up @@ -332,6 +336,8 @@ func (ph *proxyHandler) ComStmtExecute(c *mysql.Conn, prepare *mysql.PrepareData
}
}()

ctx = context.WithValue(ctx, CONN_ID_KEY, int(c.ConnectionID))

if session.SessionPb().Options.Workload == querypb.ExecuteOptions_OLAP {
err := ph.proxy.StreamExecute(ctx, session, prepare.PrepareStmt, prepare.BindVars, callback)
return sqlerror.NewSQLErrorFromError(err)
Expand Down Expand Up @@ -396,6 +402,8 @@ func (ph *proxyHandler) getSession(ctx context.Context, c *mysql.Conn) (*vtgatec
options.ClientFoundRows = true
}

ctx = context.WithValue(ctx, CONN_ID_KEY, int(c.ConnectionID))

var err error
session, err = ph.proxy.NewSession(ctx, options, c.Attributes)
if err != nil {
Expand All @@ -420,6 +428,9 @@ func (ph *proxyHandler) closeSession(ctx context.Context, c *mysql.Conn) {
if session.SessionPb().InTransaction {
defer atomic.AddInt32(&busyConnections, -1)
}

ctx = context.WithValue(ctx, CONN_ID_KEY, int(c.ConnectionID))

err := ph.proxy.CloseSession(ctx, session)
if err != nil {
log.Errorf("Error happened in transaction rollback: %v", err)
Expand Down
101 changes: 101 additions & 0 deletions go/vt/vtgateproxy/sim/vtgateproxysim.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
package main

import (
"flag"
"fmt"
"math/rand"
"sort"
"time"

"github.com/guptarohit/asciigraph"

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Region Sharding example using etcd on ubuntu-22.04

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Local example using consul on ubuntu-22.04

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Local example using etcd on ubuntu-22.04

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / End-to-End Test

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (12)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / End-to-End Test (Race)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Docker Test Cluster 10

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Docker Test Cluster 10

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (mysql80)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtgate_schema_tracker)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (schemadiff_vrepl)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vreplication_cellalias)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vttablet_prscomplex)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vreplication_basic)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (ers_prs_newfeatures_heavy)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (onlineddl_vrepl_stress)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (15)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtgate_vschema)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (onlineddl_vrepl_suite)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Docker Test Cluster 25

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Docker Test Cluster 25

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Docker Test Cluster 25

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Docker Test Cluster 25

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (onlineddl_vrepl)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtgate_transaction)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtgate_unsharded)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtgate_topo)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtgate_schema)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtctlbackup_sharded_clustertest_heavy)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (xb_recovery)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (onlineddl_vrepl_stress_suite)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (tabletmanager_tablegc)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vreplication_across_db_versions)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (tabletmanager_throttler_topo)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtgate_readafterwrite)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vstream)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (13)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run Upgrade Downgrade Test - Reparent Old VTTablet

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (topo_connection_cache)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtbackup)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtgate_foreignkey_stress)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vreplication_migrate_vdiff2_convert_tz)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtgate_tablet_healthcheck_cache)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vreplication_partial_movetables_and_materialize)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (backup_pitr)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (xb_backup)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (mysql_server_vault)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (onlineddl_ghost)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtgate_vindex_heavy)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (backup_pitr_mysqlshell)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (22)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtgate_gen4)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtgate_general_heavy)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vreplication_v2)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtgate_reservedconn)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtgate_queries)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtgate_partial_keyspace)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (backup_pitr_xtrabackup)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run Upgrade Downgrade Test - Reparent Old Vtctl

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (18)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (onlineddl_scheduler)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtgate_topo_etcd)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (tabletmanager_consul)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtgate_godriver)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Region Sharding example using etcd on ubuntu-22.04

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vreplication_foreign_key_stress)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / End-to-End Test

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtgate_topo_consul)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run Upgrade Downgrade Test - Query Serving (Schema)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (21)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtorc)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (22)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtgate_topo)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Local example using zk2 on ubuntu-22.04

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtgate_concurrentdml)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Docker Test Cluster 25

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Docker Test Cluster 25

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Docker Test Cluster 25

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Docker Test Cluster 25

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (onlineddl_revert)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtgate_concurrentdml)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run Upgrade Downgrade Test - Backups - E2E

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtgate_foreignkey_stress)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vreplication_migrate_vdiff2_convert_tz)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / End-to-End Test (Race)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Unit Test (mysql80)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run Upgrade Downgrade Test - Backups - Manual

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run Upgrade Downgrade Test - Query Serving (Queries)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtgate_topo_consul)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vstream)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Unit Test (Race)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vreplication_cellalias)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Docker Test Cluster 10

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Docker Test Cluster 10

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (onlineddl_vrepl_stress_suite)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (xb_recovery)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtgate_transaction)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtgate_tablet_healthcheck_cache)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (onlineddl_vrepl_suite)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (mysql80)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtgate_readafterwrite)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtgate_reservedconn)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (onlineddl_vrepl)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtgate_vindex_heavy)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (topo_connection_cache)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (18)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vttablet_prscomplex)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtgate_schema_tracker)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtgate_unsharded)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (onlineddl_ghost)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtgate_gen4)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtgate_vschema)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (15)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (onlineddl_vrepl_stress)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (21)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtctlbackup_sharded_clustertest_heavy)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (13)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (onlineddl_scheduler)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Unit Test (Race)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtgate_topo_etcd)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (tabletmanager_consul)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (backup_pitr_mysqlshell)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtgate_partial_keyspace)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (backup_pitr_xtrabackup)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run Upgrade Downgrade Test - Backups - E2E

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtorc)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtbackup)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vreplication_v2)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run Upgrade Downgrade Test - Reparent Old Vtctl

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtgate_schema)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (onlineddl_revert)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtgate_queries)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (tabletmanager_tablegc)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtgate_general_heavy)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (ers_prs_newfeatures_heavy)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vreplication_basic)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (12)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (xb_backup)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run Upgrade Downgrade Test - Backups - Manual

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (mysql_server_vault)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vreplication_partial_movetables_and_materialize)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vtgate_godriver)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (tabletmanager_throttler_topo)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vreplication_across_db_versions)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run Upgrade Downgrade Test - Query Serving (Queries)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (schemadiff_vrepl)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (backup_pitr)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run endtoend tests on Cluster (vreplication_foreign_key_stress)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run Upgrade Downgrade Test - Reparent Old VTTablet

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Unit Test (mysql80)

no required module provides package github.com/guptarohit/asciigraph; to add it:

Check failure on line 10 in go/vt/vtgateproxy/sim/vtgateproxysim.go

View workflow job for this annotation

GitHub Actions / Run Upgrade Downgrade Test - Query Serving (Schema)

no required module provides package github.com/guptarohit/asciigraph; to add it:
)

var (
numClients = flag.Int("c", 9761, "Number of clients")
numVtgates = flag.Int("v", 1068, "Number of vtgates")
numConnections = flag.Int("n", 4, "number of connections per client host")
numZones = flag.Int("z", 4, "number of zones")
)

func main() {
rnd := rand.New(rand.NewSource(time.Now().UnixNano()))

flag.Parse()

fmt.Printf("Simulating %d clients => %d vtgates with %d zones %d conns per client\n\n",
*numClients, *numVtgates, *numZones, *numConnections)

var clients []string
for i := 0; i < *numClients; i++ {
clients = append(clients, fmt.Sprintf("client-%03d", i))
}

var vtgates []string
for i := 0; i < *numVtgates; i++ {
vtgates = append(vtgates, fmt.Sprintf("vtgate-%03d", i))
}

// for now just consider 1/N of the s "local"
localClients := clients[:*numClients / *numZones]
localVtgates := vtgates[:*numVtgates / *numZones]

conns := map[string][]string{}

// Simulate "discovery"
for _, client := range localClients {
var clientConns []string

for i := 0; i < *numConnections; i++ {
vtgate := localVtgates[rnd.Intn(len(localVtgates))]
clientConns = append(clientConns, vtgate)
}

conns[client] = clientConns
}

counts := map[string]int{}
for _, conns := range conns {
for _, vtgate := range conns {
counts[vtgate]++
}
}

histogram := map[int]int{}
max := 0
min := -1
for _, count := range counts {
histogram[count]++
if count > max {
max = count
}
if min == -1 || count < min {
min = count
}
}

fmt.Printf("Conns per vtgate\n%v\n\n", counts)
fmt.Printf("Histogram of conn counts\n%v\n\n", histogram)

plot := []float64{}
for i := 0; i < len(localVtgates); i++ {
plot = append(plot, float64(counts[localVtgates[i]]))
}
sort.Float64s(plot)
graph := asciigraph.Plot(plot)
fmt.Println("Number of conns per vtgate host")
fmt.Println(graph)
fmt.Println("")
fmt.Println("")

fmt.Printf("Conn count per vtgate distribution [%d - %d] (%d clients => %d vtgates with %d zones %d conns\n\n",
min, max, *numClients, *numVtgates, *numZones, *numConnections)
plot = []float64{}
for i := min; i < max; i++ {
plot = append(plot, float64(histogram[i]))
}
graph = asciigraph.Plot(plot)
fmt.Println(graph)

fmt.Printf("\nConn stats: min %d max %d spread %d spread/min %f spread/avg %f\n",
min, max, max-min, float64(max-min)/float64(min), float64(max-min)/float64((max+min)/2))
}
Loading

0 comments on commit fe69140

Please sign in to comment.