Scaling can be achieved by following the above axes.
- x-axis, horizontal scaling - When the traffic increases the application can be scaled by adding more instances. This is a simple strategy. However, concerns like handling state should be taken into consideration as multiple instances are working at the same time.
- y-axis, microservice/functional decomposition - Once the number of instances is increased, and still, if the system underperforms, logic can be decomposed into microservices. This allows scaling different parts of the application individually by adding more instances.
- z-axis, partitioning/sharing - This concerns the data layer. As the traffic increases, the data layer needs to handle the spikes. As an improvement sharding can be implemented by dividing the records to the different DBs based on a sharding function.
All the above techniques come with certain costs and the decisions need to be taken depending on the requirements of the application like availability, consistency, and partition tolerance.