This episode covers end-to-end performance optimization: tuning queries with indexing and vindexes, VTGate connection pooling, VTTablet resource tuning, and MySQL buffer, innodb, and storage settings.

Once the cluster runs securely and spans several regions, the question shifts: how fast can it go? Episode 15 covers Vitess performance optimization across three layers: queries and schema, the VTGate and VTTablet layers, then MySQL and storage. Performance is the combination of all three — optimizing just one layer gives limited results.
Episode 15 roadmap: tuning queries with indexing and vindexes, VTGate connection pooling, VTTablet resource tuning, then MySQL innodb and storage settings.
Query optimization starts with two things: MySQL indexes to speed up execution inside a shard, and vindexes to speed up routing between shards. They're different and complementary.
Standard MySQL indexes remain relevant: columns frequently used in WHERE and JOIN within one shard need regular indexes. But Vitess adds one extra rule: queries should always include the sharding key column so they don't scatter. This is the highest-impact optimization that doesn't exist in vanilla MySQL.
EXPLAIN SELECT name FROM users WHERE user_id = 42EXPLAIN shows the execution plan — at VTGate, make sure the query only touches one shard. Use EXPLAIN VITESS to see the VTGate plan:
EXPLAIN VITESS SELECT name FROM users WHERE user_id = 42The output shows whether the query is routed to one shard (fast path) or to all shards (scatter). Your target: hot-path queries are always fast path.
Info
Query optimization priority order in Vitess: first make sure there's no scatter (vindex), second make sure the right index is used (MySQL index), third tune execution parameters. The first step has the biggest impact.
Every application connection to VTGate consumes resources. VTGate uses connection pooling: a set of connections to VTTablet reused across many queries, reducing the overhead of creating MySQL connections. Configuration worth tuning:
PoolSize, StreamPoolSize) — how many connections to VTTablet.QueryTimeout — query time limit.MaxPayloadSize — maximum query payload size.vtgate:
extraFlags:
mysql_server_pool_size: 128
query_timeout: 30s
max_payload_size: 16777216mysql_server_pool_size: 128 gives VTGate 128 pooled connections per target. Rule of thumb: too small creates queues, too large overwhelms VTTablet. Measure with the metrics from episode 7, then tune based on real load.
VTTablet has two sides to its resource usage: running MySQL queries and running background work (replication, backup, VReplication). Important tuning:
PoolSize — number of concurrent queries that can run against MySQL.TransactionPoolSize — number of concurrent transactions.vttablet:
resources:
requests:
cpu: "2"
memory: 4Gi
limits:
cpu: "4"
memory: 8GiThe resources.requests and limits above determine how much resource is guaranteed and capped for each tablet. Don't give MySQL a memory limit that's too small — large tables and the buffer pool need room.
Also watch the _vt tables inside the MySQL tablet: they store Vitess state like replication position. Monitor their growth because VReplication can create vreplication tables that need regular maintenance.
At the bottom layer, MySQL needs to be tuned for its role. The highest-impact settings:
innodb_buffer_pool_size — caches data and indexes in memory. General rule: 70-80% of the memory allocated to MySQL.innodb_flush_log_at_trx_commit — the balance between durability and write speed.max_connections — connection limit; too low makes queries fail.innodb_buffer_pool_size = 6G
innodb_flush_log_at_trx_commit = 1
innodb_log_file_size = 1G
max_connections = 1000The innodb_buffer_pool_size = 6G line gives MySQL a 6GB buffer pool for caching. MySQL configuration in Vitess is provided via a custom my.cnf mounted into the tablet.
Warning
Every MySQL setting has a trade-off. innodb_flush_log_at_trx_commit = 1 gives maximum durability at write-latency cost. Other values speed up writes but can lose data on crash. Choose based on business needs, not just raw speed.
To measure the impact of optimizations, compare metrics before and after:
curl -s http://localhost:15100/metrics | grep vttablet_querycurl -s http://localhost:15100/metrics on the tablet port shows query metrics — the baseline you should watch every time you change configuration.
In this episode 15 you understood end-to-end Vitess performance optimization: making sure queries don't scatter with vindexes then use the right indexes, tuning VTGate connection pooling, tuning VTTablet resources, and setting MySQL innodb and storage.
Key takeaways:
EXPLAIN VITESS to see the query routing plan.innodb_buffer_pool_size is the most impactful MySQL setting.In the next episode, episode 16, we scale: resharding and scaling workflows — online resharding with VReplication, the difference between splitting and moving shards, scaling replicas, and vertical vs horizontal scaling. See you there!