Skip to content

Commit

Permalink
tablet: remove max-waiters setting (#15323)
Browse files Browse the repository at this point in the history
Signed-off-by: Vicent Marti <vmg@strn.cat>
  • Loading branch information
vmg authored Feb 21, 2024
1 parent a9b2c18 commit e163c9e
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 34 deletions.
3 changes: 0 additions & 3 deletions config/tablet/default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,21 +57,18 @@ oltpReadPool:
idleTimeoutSeconds: 1800 # queryserver-config-idle-timeout
maxLifetimeSeconds: 0 # queryserver-config-pool-conn-max-lifetime
prefillParallelism: 0 # queryserver-config-pool-prefill-parallelism
maxWaiters: 50000 # queryserver-config-query-pool-waiter-cap

olapReadPool:
size: 200 # queryserver-config-stream-pool-size
timeoutSeconds: 0 # queryserver-config-query-pool-timeout
idleTimeoutSeconds: 1800 # queryserver-config-idle-timeout
prefillParallelism: 0 # queryserver-config-stream-pool-prefill-parallelism
maxWaiters: 0

txPool:
size: 20 # queryserver-config-transaction-cap
timeoutSeconds: 1 # queryserver-config-txpool-timeout
idleTimeoutSeconds: 1800 # queryserver-config-idle-timeout
prefillParallelism: 0 # queryserver-config-transaction-prefill-parallelism
maxWaiters: 50000 # queryserver-config-txpool-waiter-cap

oltp:
queryTimeoutSeconds: 30 # queryserver-config-query-timeout
Expand Down
3 changes: 0 additions & 3 deletions doc/design-docs/TabletServerParamsAsYAML.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,21 +95,18 @@ oltpReadPool:
timeoutSeconds: 0 # queryserver-config-query-pool-timeout
idleTimeoutSeconds: 1800 # queryserver-config-idle-timeout
prefillParallelism: 0 # queryserver-config-pool-prefill-parallelism
maxWaiters: 50000 # queryserver-config-query-pool-waiter-cap
olapReadPool:
size: 200 # queryserver-config-stream-pool-size
timeoutSeconds: 0 # queryserver-config-query-pool-timeout
idleTimeoutSeconds: 1800 # queryserver-config-idle-timeout
prefillParallelism: 0 # queryserver-config-stream-pool-prefill-parallelism
maxWaiters: 0
txPool:
size: 20 # queryserver-config-transaction-cap
timeoutSeconds: 1 # queryserver-config-txpool-timeout
idleTimeoutSeconds: 1800 # queryserver-config-idle-timeout
prefillParallelism: 0 # queryserver-config-transaction-prefill-parallelism
maxWaiters: 50000 # queryserver-config-txpool-waiter-cap
oltp:
queryTimeoutSeconds: 30 # queryserver-config-query-timeout
Expand Down
3 changes: 0 additions & 3 deletions go/flags/endtoend/vtcombo.txt
Original file line number Diff line number Diff line change
Expand Up @@ -283,21 +283,18 @@ Flags:
--queryserver-config-pool-size int query server read pool size, connection pool is used by regular queries (non streaming, not in a transaction) (default 16)
--queryserver-config-query-cache-memory int query server query cache size in bytes, maximum amount of memory to be used for caching. vttablet analyzes every incoming query and generate a query plan, these plans are being cached in a lru cache. This config controls the capacity of the lru cache. (default 33554432)
--queryserver-config-query-pool-timeout duration query server query pool timeout, it is how long vttablet waits for a connection from the query pool. If set to 0 (default) then the overall query timeout is used instead.
--queryserver-config-query-pool-waiter-cap int query server query pool waiter limit, this is the maximum number of queries that can be queued waiting to get a connection (default 5000)
--queryserver-config-query-timeout duration query server query timeout, this is the query timeout in vttablet side. If a query takes more than this timeout, it will be killed. (default 30s)
--queryserver-config-schema-change-signal query server schema signal, will signal connected vtgates that schema has changed whenever this is detected. VTGates will need to have -schema_change_signal enabled for this to work (default true)
--queryserver-config-schema-reload-time duration query server schema reload time, how often vttablet reloads schemas from underlying MySQL instance. vttablet keeps table schemas in its own memory and periodically refreshes it from MySQL. This config controls the reload time. (default 30m0s)
--queryserver-config-stream-buffer-size int query server stream buffer size, the maximum number of bytes sent from vttablet for each stream call. It's recommended to keep this value in sync with vtgate's stream_buffer_size. (default 32768)
--queryserver-config-stream-pool-size int query server stream connection pool size, stream pool is used by stream queries: queries that return results to client in a streaming fashion (default 200)
--queryserver-config-stream-pool-timeout duration query server stream pool timeout, it is how long vttablet waits for a connection from the stream pool. If set to 0 (default) then there is no timeout.
--queryserver-config-stream-pool-waiter-cap int query server stream pool waiter limit, this is the maximum number of streaming queries that can be queued waiting to get a connection
--queryserver-config-strict-table-acl only allow queries that pass table acl checks
--queryserver-config-terse-errors prevent bind vars from escaping in client error messages
--queryserver-config-transaction-cap int query server transaction cap is the maximum number of transactions allowed to happen at any given point of a time for a single vttablet. E.g. by setting transaction cap to 100, there are at most 100 transactions will be processed by a vttablet and the 101th transaction will be blocked (and fail if it cannot get connection within specified timeout) (default 20)
--queryserver-config-transaction-timeout duration query server transaction timeout, a transaction will be killed if it takes longer than this value (default 30s)
--queryserver-config-truncate-error-len int truncate errors sent to client if they are longer than this value (0 means do not truncate)
--queryserver-config-txpool-timeout duration query server transaction pool timeout, it is how long vttablet waits if tx pool is full (default 1s)
--queryserver-config-txpool-waiter-cap int query server transaction pool waiter limit, this is the maximum number of transactions that can be queued waiting to get a connection (default 5000)
--queryserver-config-warn-result-size int query server result size warning threshold, warn if number of rows returned from vttablet for non-streaming queries exceeds this
--queryserver-enable-settings-pool Enable pooling of connections with modified system settings (default true)
--queryserver-enable-views Enable views support in vttablet.
Expand Down
3 changes: 0 additions & 3 deletions go/flags/endtoend/vttablet.txt
Original file line number Diff line number Diff line change
Expand Up @@ -276,21 +276,18 @@ Flags:
--queryserver-config-pool-size int query server read pool size, connection pool is used by regular queries (non streaming, not in a transaction) (default 16)
--queryserver-config-query-cache-memory int query server query cache size in bytes, maximum amount of memory to be used for caching. vttablet analyzes every incoming query and generate a query plan, these plans are being cached in a lru cache. This config controls the capacity of the lru cache. (default 33554432)
--queryserver-config-query-pool-timeout duration query server query pool timeout, it is how long vttablet waits for a connection from the query pool. If set to 0 (default) then the overall query timeout is used instead.
--queryserver-config-query-pool-waiter-cap int query server query pool waiter limit, this is the maximum number of queries that can be queued waiting to get a connection (default 5000)
--queryserver-config-query-timeout duration query server query timeout, this is the query timeout in vttablet side. If a query takes more than this timeout, it will be killed. (default 30s)
--queryserver-config-schema-change-signal query server schema signal, will signal connected vtgates that schema has changed whenever this is detected. VTGates will need to have -schema_change_signal enabled for this to work (default true)
--queryserver-config-schema-reload-time duration query server schema reload time, how often vttablet reloads schemas from underlying MySQL instance. vttablet keeps table schemas in its own memory and periodically refreshes it from MySQL. This config controls the reload time. (default 30m0s)
--queryserver-config-stream-buffer-size int query server stream buffer size, the maximum number of bytes sent from vttablet for each stream call. It's recommended to keep this value in sync with vtgate's stream_buffer_size. (default 32768)
--queryserver-config-stream-pool-size int query server stream connection pool size, stream pool is used by stream queries: queries that return results to client in a streaming fashion (default 200)
--queryserver-config-stream-pool-timeout duration query server stream pool timeout, it is how long vttablet waits for a connection from the stream pool. If set to 0 (default) then there is no timeout.
--queryserver-config-stream-pool-waiter-cap int query server stream pool waiter limit, this is the maximum number of streaming queries that can be queued waiting to get a connection
--queryserver-config-strict-table-acl only allow queries that pass table acl checks
--queryserver-config-terse-errors prevent bind vars from escaping in client error messages
--queryserver-config-transaction-cap int query server transaction cap is the maximum number of transactions allowed to happen at any given point of a time for a single vttablet. E.g. by setting transaction cap to 100, there are at most 100 transactions will be processed by a vttablet and the 101th transaction will be blocked (and fail if it cannot get connection within specified timeout) (default 20)
--queryserver-config-transaction-timeout duration query server transaction timeout, a transaction will be killed if it takes longer than this value (default 30s)
--queryserver-config-truncate-error-len int truncate errors sent to client if they are longer than this value (0 means do not truncate)
--queryserver-config-txpool-timeout duration query server transaction pool timeout, it is how long vttablet waits if tx pool is full (default 1s)
--queryserver-config-txpool-waiter-cap int query server transaction pool waiter limit, this is the maximum number of transactions that can be queued waiting to get a connection (default 5000)
--queryserver-config-warn-result-size int query server result size warning threshold, warn if number of rows returned from vttablet for non-streaming queries exceeds this
--queryserver-enable-settings-pool Enable pooling of connections with modified system settings (default true)
--queryserver-enable-views Enable views support in vttablet.
Expand Down
17 changes: 9 additions & 8 deletions go/vt/vttablet/tabletserver/tabletenv/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,15 @@ func registerTabletEnvFlags(fs *pflag.FlagSet) {
fs.DurationVar(&currentConfig.TxPool.Timeout, "queryserver-config-txpool-timeout", defaultConfig.TxPool.Timeout, "query server transaction pool timeout, it is how long vttablet waits if tx pool is full")
fs.DurationVar(&currentConfig.OltpReadPool.IdleTimeout, "queryserver-config-idle-timeout", defaultConfig.OltpReadPool.IdleTimeout, "query server idle timeout, vttablet manages various mysql connection pools. This config means if a connection has not been used in given idle timeout, this connection will be removed from pool. This effectively manages number of connection objects and optimize the pool performance.")
fs.DurationVar(&currentConfig.OltpReadPool.MaxLifetime, "queryserver-config-pool-conn-max-lifetime", defaultConfig.OltpReadPool.MaxLifetime, "query server connection max lifetime, vttablet manages various mysql connection pools. This config means if a connection has lived at least this long, it connection will be removed from pool upon the next time it is returned to the pool.")
fs.IntVar(&currentConfig.OltpReadPool.MaxWaiters, "queryserver-config-query-pool-waiter-cap", defaultConfig.OltpReadPool.MaxWaiters, "query server query pool waiter limit, this is the maximum number of queries that can be queued waiting to get a connection")
fs.IntVar(&currentConfig.OlapReadPool.MaxWaiters, "queryserver-config-stream-pool-waiter-cap", defaultConfig.OlapReadPool.MaxWaiters, "query server stream pool waiter limit, this is the maximum number of streaming queries that can be queued waiting to get a connection")
fs.IntVar(&currentConfig.TxPool.MaxWaiters, "queryserver-config-txpool-waiter-cap", defaultConfig.TxPool.MaxWaiters, "query server transaction pool waiter limit, this is the maximum number of transactions that can be queued waiting to get a connection")

var unused int
fs.IntVar(&unused, "queryserver-config-query-pool-waiter-cap", 0, "query server query pool waiter limit, this is the maximum number of queries that can be queued waiting to get a connection")
fs.IntVar(&unused, "queryserver-config-stream-pool-waiter-cap", 0, "query server stream pool waiter limit, this is the maximum number of streaming queries that can be queued waiting to get a connection")
fs.IntVar(&unused, "queryserver-config-txpool-waiter-cap", 0, "query server transaction pool waiter limit, this is the maximum number of transactions that can be queued waiting to get a connection")
fs.MarkDeprecated("queryserver-config-query-pool-waiter-cap", "The new connection pool in v19 does not limit waiter capacity. This flag will be removed in a future release.")
fs.MarkDeprecated("queryserver-config-stream-pool-waiter-cap", "The new connection pool in v19 does not limit waiter capacity. This flag will be removed in a future release.")
fs.MarkDeprecated("queryserver-config-txpool-waiter-cap", "The new connection pool in v19 does not limit waiter capacity. This flag will be removed in a future release.")

// tableacl related configurations.
fs.BoolVar(&currentConfig.StrictTableACL, "queryserver-config-strict-table-acl", defaultConfig.StrictTableACL, "only allow queries that pass table acl checks")
fs.BoolVar(&currentConfig.EnableTableACLDryRun, "queryserver-config-enable-table-acl-dry-run", defaultConfig.EnableTableACLDryRun, "If this flag is enabled, tabletserver will emit monitoring metrics and let the request pass regardless of table acl check results")
Expand Down Expand Up @@ -440,7 +446,6 @@ type ConnPoolConfig struct {
IdleTimeout time.Duration `json:"idleTimeoutSeconds,omitempty"`
MaxLifetime time.Duration `json:"maxLifetimeSeconds,omitempty"`
PrefillParallelism int `json:"prefillParallelism,omitempty"`
MaxWaiters int `json:"maxWaiters,omitempty"`
}

func (cfg *ConnPoolConfig) MarshalJSON() ([]byte, error) {
Expand Down Expand Up @@ -477,7 +482,6 @@ func (cfg *ConnPoolConfig) UnmarshalJSON(data []byte) (err error) {
IdleTimeout string `json:"idleTimeoutSeconds,omitempty"`
MaxLifetime string `json:"maxLifetimeSeconds,omitempty"`
PrefillParallelism int `json:"prefillParallelism,omitempty"`
MaxWaiters int `json:"maxWaiters,omitempty"`
}

if err := json.Unmarshal(data, &tmp); err != nil {
Expand Down Expand Up @@ -507,7 +511,6 @@ func (cfg *ConnPoolConfig) UnmarshalJSON(data []byte) (err error) {

cfg.Size = tmp.Size
cfg.PrefillParallelism = tmp.PrefillParallelism
cfg.MaxWaiters = tmp.MaxWaiters

return nil
}
Expand Down Expand Up @@ -945,7 +948,6 @@ var defaultConfig = TabletConfig{
OltpReadPool: ConnPoolConfig{
Size: 16,
IdleTimeout: 30 * time.Minute,
MaxWaiters: 5000,
},
OlapReadPool: ConnPoolConfig{
Size: 200,
Expand All @@ -955,7 +957,6 @@ var defaultConfig = TabletConfig{
Size: 20,
Timeout: time.Second,
IdleTimeout: 30 * time.Minute,
MaxWaiters: 5000,
},
Olap: OlapConfig{
TxTimeout: 30 * time.Second,
Expand Down
6 changes: 0 additions & 6 deletions go/vt/vttablet/tabletserver/tabletenv/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ func TestConfigParse(t *testing.T) {
},
OltpReadPool: ConnPoolConfig{
Size: 16,
MaxWaiters: 40,
Timeout: 10 * time.Second,
IdleTimeout: 20 * time.Second,
MaxLifetime: 50 * time.Second,
Expand Down Expand Up @@ -86,7 +85,6 @@ oltp: {}
oltpReadPool:
idleTimeoutSeconds: 20s
maxLifetimeSeconds: 50s
maxWaiters: 40
size: 16
timeoutSeconds: 10s
replicationTracker: {}
Expand All @@ -109,7 +107,6 @@ txPool: {}
oltpReadPool:
size: 16
idleTimeoutSeconds: 20s
maxWaiters: 40
maxLifetimeSeconds: 50s
`)
gotCfg := cfg
Expand Down Expand Up @@ -148,7 +145,6 @@ oltp:
txTimeoutSeconds: 30s
oltpReadPool:
idleTimeoutSeconds: 30m0s
maxWaiters: 5000
size: 16
queryCacheDoorkeeper: true
queryCacheMemory: 33554432
Expand All @@ -164,7 +160,6 @@ signalWhenSchemaChange: true
streamBufferSize: 32768
txPool:
idleTimeoutSeconds: 30m0s
maxWaiters: 5000
size: 20
timeoutSeconds: 1s
`
Expand All @@ -178,7 +173,6 @@ func TestClone(t *testing.T) {
cfg1 := &TabletConfig{
OltpReadPool: ConnPoolConfig{
Size: 16,
MaxWaiters: 40,
Timeout: 10 * time.Second,
IdleTimeout: 20 * time.Second,
MaxLifetime: 50 * time.Second,
Expand Down
8 changes: 0 additions & 8 deletions go/vt/vttablet/tabletserver/tx_pool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,6 @@ func TestTxPoolWaitTimeoutError(t *testing.T) {

env := newEnv("TabletServerTest")
env.Config().TxPool.Size = 1
env.Config().TxPool.MaxWaiters = 0
env.Config().TxPool.Timeout = time.Second
// given
db, txPool, _, closer := setupWithEnv(t, env)
Expand Down Expand Up @@ -428,7 +427,6 @@ func TestTxTimeoutKillsTransactions(t *testing.T) {

env := newEnv("TabletServerTest")
env.Config().TxPool.Size = 1
env.Config().TxPool.MaxWaiters = 0
env.Config().Oltp.TxTimeout = time.Second
_, txPool, limiter, closer := setupWithEnv(t, env)
defer closer()
Expand Down Expand Up @@ -477,7 +475,6 @@ func TestTxTimeoutDoesNotKillShortLivedTransactions(t *testing.T) {

env := newEnv("TabletServerTest")
env.Config().TxPool.Size = 1
env.Config().TxPool.MaxWaiters = 0
env.Config().Oltp.TxTimeout = time.Second
_, txPool, _, closer := setupWithEnv(t, env)
defer closer()
Expand Down Expand Up @@ -510,7 +507,6 @@ func TestTxTimeoutKillsOlapTransactions(t *testing.T) {

env := newEnv("TabletServerTest")
env.Config().TxPool.Size = 1
env.Config().TxPool.MaxWaiters = 0
env.Config().Oltp.TxTimeout = time.Second
env.Config().Olap.TxTimeout = 2 * time.Second
_, txPool, _, closer := setupWithEnv(t, env)
Expand Down Expand Up @@ -548,7 +544,6 @@ func TestTxTimeoutNotEnforcedForZeroLengthTimeouts(t *testing.T) {

env := newEnv("TabletServerTest")
env.Config().TxPool.Size = 2
env.Config().TxPool.MaxWaiters = 0
env.Config().Oltp.TxTimeout = 0
env.Config().Olap.TxTimeout = 0
_, txPool, _, closer := setupWithEnv(t, env)
Expand Down Expand Up @@ -591,7 +586,6 @@ func TestTxTimeoutReservedConn(t *testing.T) {

env := newEnv("TabletServerTest")
env.Config().TxPool.Size = 1
env.Config().TxPool.MaxWaiters = 0
env.Config().Oltp.TxTimeout = time.Second
env.Config().Olap.TxTimeout = 2 * time.Second
_, txPool, _, closer := setupWithEnv(t, env)
Expand Down Expand Up @@ -634,7 +628,6 @@ func TestTxTimeoutReusedReservedConn(t *testing.T) {

env := newEnv("TabletServerTest")
env.Config().TxPool.Size = 1
env.Config().TxPool.MaxWaiters = 0
env.Config().Oltp.TxTimeout = time.Second
env.Config().Olap.TxTimeout = 2 * time.Second
_, txPool, _, closer := setupWithEnv(t, env)
Expand Down Expand Up @@ -820,7 +813,6 @@ func newEnv(exporterName string) tabletenv.Env {
cfg.TxPool.Size = 300
cfg.Oltp.TxTimeout = 30 * time.Second
cfg.TxPool.Timeout = 40 * time.Second
cfg.TxPool.MaxWaiters = 500000
cfg.OltpReadPool.IdleTimeout = 30 * time.Second
cfg.OlapReadPool.IdleTimeout = 30 * time.Second
cfg.TxPool.IdleTimeout = 30 * time.Second
Expand Down

0 comments on commit e163c9e

Please sign in to comment.