Explaining scaling and availability concepts Through the LEGO Analogy

Ali Khalilvandi
4 min readApr 16, 2023

--

Vertical and horizontal scaling are two strategies for increasing a system’s capacity and performance. Let’s use the analogy of LEGO bricks to explain these concepts.

Vertical Scaling

Building a Taller LEGO Tower: Vertical scaling is like constructing a taller LEGO tower by adding more bricks on top of one another. In the context of a software system, vertical scaling involves adding more resources (such as CPU, memory, or storage) to a single server or machine to increase its capacity and performance. This approach can improve the performance of the system, but it has limitations, such as:

  • Hardware limitations: Just like a LEGO tower, there’s a limit to how high you can build before the structure becomes unstable or reaches the maximum height possible. Similarly, a server can only be upgraded to a certain extent, after which it reaches the maximum capacity of its hardware.
  • Downtime: When vertically scaling a LEGO tower, you might need to dismantle parts of it to add more bricks, causing temporary instability. In a software system, vertical scaling often requires downtime, as the server needs to be taken offline for hardware upgrades.
  • Cost: Upgrading server hardware can be expensive, just like purchasing more LEGO bricks to build a taller tower.

Horizontal Scaling

Building Multiple LEGO Towers: Horizontal scaling is like constructing multiple LEGO towers side by side, each contributing to the overall capacity of the system. In the context of software systems, horizontal scaling involves adding more servers or machines to the system, distributing the workload across multiple nodes. This approach has several advantages:

  • Scalability: Just like you can keep adding more LEGO towers to expand your structure, you can continue to add servers to a horizontally-scaled system to increase its capacity and performance.
  • Fault tolerance: If one LEGO tower falls, the other towers remain intact. Similarly, in a horizontally-scaled system, if one server fails, the others can continue to handle the workload, providing fault tolerance and increased reliability.
  • Load balancing: Distributing the workload across multiple servers can help balance the load and prevent any single server from becoming a bottleneck, just like distributing the weight across multiple LEGO towers can create a more stable and balanced structure.

High availability

High availability is a characteristic of a system that aims to ensure a high level of operational performance and minimal downtime. It is achieved by designing redundant components and mechanisms to handle failures gracefully. Let’s use the analogy of LEGO bricks to explain high availability.

Imagine you are building a LEGO bridge that connects two important areas in your LEGO city. High availability in this context would mean constructing the bridge so that it remains functional and accessible even if some parts or components of the bridge fail or are temporarily unavailable.

  1. Redundancy — Duplicate LEGO Bridge Components: To ensure high availability of your LEGO bridge, you would create duplicate bridge components that can be used as backups in case the primary components fail. Similarly, in a software system, high availability is achieved by using redundant components (such as servers, network devices, or storage systems) that can take over if the primary components fail or need maintenance.
  2. Failover Mechanism — Swapping LEGO Bridge Components: Imagine that one section of your LEGO bridge becomes unstable or damaged. To maintain high availability, you would need to quickly replace the damaged section with a backup component to keep the bridge functional. In a software system, a failover mechanism is used to automatically switch from a failed component to a redundant component, minimizing downtime and ensuring that the system remains operational.
  3. Load Balancing — Distributing Traffic Across LEGO Bridge Components: In the LEGO bridge scenario, high availability can also be achieved by distributing the traffic across multiple bridge components to prevent any single component from becoming overloaded or causing a bottleneck. Similarly, in a software system, load balancing is used to distribute the workload across multiple components, preventing any single component from becoming a point of failure.
  4. Monitoring and Maintenance — Inspecting the LEGO Bridge: Regularly inspecting and maintaining the LEGO bridge ensures that all components remain in good condition and that any potential issues are detected and addressed before they cause problems. Similarly, in a software system, monitoring and maintenance are crucial for maintaining high availability, as they help detect and resolve issues before they lead to failures.

--

--

Ali Khalilvandi

Senior Software Engineer, interested in Observability, ML, generative AI, MLOps,AWS. Harnessing the power of generative AI for writing great articles.