Kato platform components have two scaling methods:
- Vertical expansion: increase or decrease the memory of the component (currently the component CPU and memory are linked, according to a certain
- Horizontal scaling: increase or decrease the number of component instances, suitable for stateless components and stateful horizontal cluster components
- During vertical scaling, the platform will automatically adjust resources and restart components, single-node components will be interrupted, and multi-node components will not be affected.
- When the platform is scaled horizontally, the platform is operated by rolling new or offline nodes, so the operation will not affect the existing components.
Vertical Scaling CPU and Memory Ratio
|Application value ratio (CPU/memory)||Limit value ratio (CPU/memory)|
Kubernetes is divided into application values and limit values for CPU and memory. For details, see: Manage Container Computing Resourcesplatform. The currently adjusted ratio of CPU to memory has been verified in the production environment to meet most component types.
If you customize CPU allocation for some CPU-intensive components, you can configure environment variables:
- ES_CPULIMIT: CPU limit value
- ES_CPUREQUEST: CPU request value
Conditions for Horizontal Scaling of Components
We generally call components that do not need to save their own running state as stateless components, such as Web components. Generally, as long as the caching system uses third-party components such as Redis, Web components can be considered stateless components that can be scaled horizontally.
So someone has to ask, what should I do if my web components need to access files, Kato will handle the direct persistent storage synchronization of the components. That is, the persistent storage used by each component instance is the same file system, which is the practice of separating computing and data.
The horizontal scaling conditions of stateful components will be more complicated. To support stateful scaling, the application must first support clustering horizontal expansion.
For example, if we deploy a Mysql component, we directly extend it to two instances. What will happen? Both instances can work normally, but there is no relationship between them, which means that they are two Mysql components. Obviously this is not acceptable.
So what stateful components can scale horizontally, mainly in the following two categories:
- Clustering components that can scale the cluster horizontally, such as Etcd, Zookeeper, Xiaoqiang database, TiDB, etc.
- Master-slave cluster components, we can generally scale the slave components horizontally. Such as Mysql, Redis, MongoDB, etc.
Reference document for component instance automatic horizontal scaling function: Automatic scaling
The method of making stateful component cluster applications will be explained in the theme document