Skip to content

Commit d671baf

Browse files
Add another tablet load balancer algorithm: random (#18787)
Signed-off-by: Nick Van Wiggeren <[email protected]> Signed-off-by: Nick Van Wiggeren <[email protected]> Co-authored-by: Tim Vaillancourt <[email protected]>
1 parent 96525ca commit d671baf

File tree

11 files changed

+1062
-31
lines changed

11 files changed

+1062
-31
lines changed

go/flags/endtoend/vtgate.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ Flags:
2828
--allow-kill-statement Allows the execution of kill statement
2929
--allowed-tablet-types strings Specifies the tablet types this vtgate is allowed to route queries to. Should be provided as a comma-separated set of tablet types.
3030
--alsologtostderr log to standard error as well as files
31-
--balancer-keyspaces strings When in balanced mode, a comma-separated list of keyspaces for which to use the balancer (optional)
32-
--balancer-vtgate-cells strings When in balanced mode, a comma-separated list of cells that contain vtgates (required)
31+
--balancer-keyspaces strings Comma-separated list of keyspaces for which to use the balancer (optional). If empty, applies to all keyspaces.
32+
--balancer-vtgate-cells strings Comma-separated list of cells that contain vttablets. For 'prefer-cell' mode, this is required. For 'random' mode, this is optional and filters tablets to those cells.
3333
--bind-address string Bind address for the server. If empty, the server will listen on all available unicast and anycast IP addresses of the local system.
3434
--buffer-drain-concurrency int Maximum number of requests retried simultaneously. More concurrency will increase the load on the PRIMARY vttablet when draining the buffer. (default 1)
3535
--buffer-keyspace-shards string If not empty, limit buffering to these entries (comma separated). Entry format: keyspace or keyspace/shard. Requires --enable_buffer=true.
@@ -56,7 +56,7 @@ Flags:
5656
--discovery-high-replication-lag-minimum-serving duration Threshold above which replication lag is considered too high when applying the min_number_serving_vttablets flag. (default 2h0m0s)
5757
--discovery-low-replication-lag duration Threshold below which replication lag is considered low enough to be healthy. (default 30s)
5858
--emit-stats If set, emit stats to push-based monitoring and stats backends
59-
--enable-balancer Enable the tablet balancer to evenly spread query load for a given tablet type
59+
--enable-balancer (DEPRECATED: use --vtgate-balancer-mode instead) Enable the tablet balancer to evenly spread query load for a given tablet type
6060
--enable-buffer Enable buffering (stalling) of primary traffic during failovers.
6161
--enable-buffer-dry-run Detect and log failover events, but do not actually buffer requests.
6262
--enable-direct-ddl Allow users to submit direct DDL statements (default true)
@@ -246,6 +246,7 @@ Flags:
246246
-v, --version print binary version
247247
--vmodule vModuleFlag comma-separated list of pattern=N settings for file-filtered logging
248248
--vschema-ddl-authorized-users string List of users authorized to execute vschema ddl operations, or '%' to allow all users.
249+
--vtgate-balancer-mode string Tablet balancer mode (options: cell, prefer-cell, random). Defaults to 'cell' which shuffles tablets in the local cell.
249250
--vtgate-config-terse-errors prevent bind vars from escaping in returned errors
250251
--warming-reads-concurrency int Number of concurrent warming reads allowed (default 500)
251252
--warming-reads-percent int Percentage of reads on the primary to forward to replicas. Useful for keeping buffer pools warm

go/test/endtoend/cluster/cluster_process.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,7 @@ func (cluster *LocalProcessCluster) AddShard(keyspaceName string, shardName stri
453453
HTTPPort: cluster.GetAndReservePort(),
454454
GrpcPort: cluster.GetAndReservePort(),
455455
MySQLPort: cluster.GetAndReservePort(),
456+
Cell: cluster.Cell,
456457
Alias: fmt.Sprintf("%s-%010d", cluster.Cell, tabletUID),
457458
}
458459
if i == 0 { // Make the first one as primary

0 commit comments

Comments
 (0)