Service Instance Pattern

Intent

This pattern accommodates increasing workloads by distributing the loads on multiple service instances. The Service Instance pattern is also known as Service Load Balancing.

Context and problem

The quality attributes of a software system are non-functional properties driven by the system’s architectural constraints. There are many quality attributes, and their priorities vary largely from project to project. The following are almost always present:

  • Availability is the proportion of time that all system components are fully functional and operational. It is measured as a percentage of the total system downtime over a fixed period.

  • Scalability is the ability of a system to handle increases in the load without impacting the performance.

An application can be scaled vertically or horizontally. Vertical scaling (scaling up) is achieved by adding more resources to a single node in a system to give greater capacity to this node. This way of scaling is limited by the amount of CPU/RAM that can be added to a single host. There is another way of increasing the capacity of a system that can be achieved with commodity hardware (rather than supercomputers) called horizontal scaling. Vertical scaling increases the capacity of a single node, but it does not decrease the overall load on the nodes. Horizontal scaling (scaling out), on the other hand, increases the number of nodes in a cluster and reduces the load on the individual nodes. In this setup, each node has the same capacity, but the load on the nodes is decreased as it spreads across more nodes. While vertical scaling is easier, it is more expensive and with a limited reach. On the other hand, horizontal scaling is cheaper (from a hardware point of view) but harder to implement and sometimes not even possible. The Service Instance pattern results from applying horizontal scaling principles to the application layer.

Get hands-on with 1400+ tech skills courses.