Horizontal Scaling


Welcome back. In this video, we are going to talk about scaling, which for the TiDB platform you can independently perform across two different dimensions.

First, you can scale the SQL processing by changing the number of TiDB Servers. Since TiDB servers are stateless, this is a very quick operation, both in terms of scaling out by increasing the count of TiDB instances and in terms of scaling in by decreasing the count.

The second type of scaling is with regard to storage and the number of TiKV Servers. With TiKV, it is relatively simple to increase or scale up the number of instances, but with decreasing there is a little bit of added complexity. Because TiKV maintains state (it stores your data), scale in activity has to be performed in such a fashion that it doesn't degrade the health of the cluster.

That is to say, scaling TiKV involves an act of rebalancing the Regions (which is TiDB Platform terminology for units of approximately 100MB each). A graceful scale in leaves sufficient time for servers to be drained of their Regions with the remaining TiKV servers having sufficient free capacity to take over.

This problem is not unique to TiKV. The good news is: Kubernetes understands that there are these additional steps to scale stateful services. With Kubernetes and operator, scaling both SQL and storage is not only possible but actually very easy to achieve.