Skip to content
Computer Science · Grade 12 · Networks and Distributed Systems · Term 3

Distributed Systems and Microservices

Introduction to distributed systems architecture and the benefits of microservices for scalability and resilience.

Ontario Curriculum ExpectationsCS.N.11CS.SE.2

About This Topic

Distributed systems involve multiple computers coordinating to achieve common goals, such as handling large-scale web applications. Students explore how microservices architecture divides applications into independent, loosely coupled services, unlike monolithic designs where all components are tightly integrated. Key benefits include improved scalability by scaling individual services, greater resilience through fault isolation, and faster development cycles with specialized teams. Students analyze real-world examples like e-commerce platforms that use microservices to manage traffic spikes.

This topic aligns with Ontario's Grade 12 Computer Science curriculum standards CS.N.11 and CS.SE.2, emphasizing networks and software engineering. Students tackle challenges like ensuring data consistency across services using techniques such as eventual consistency or sagas, and they design simple distributed systems for web apps. These activities build skills in systems thinking, trade-off evaluation, and problem-solving under constraints like network latency.

Active learning shines here because distributed concepts are abstract and counterintuitive. When students prototype microservices with Docker containers or simulate failures in group scenarios, they witness scalability firsthand and debug real issues, making theoretical advantages tangible and memorable.

Key Questions

  1. Explain the advantages of a microservices architecture over a monolithic application.
  2. Analyze the challenges of managing data consistency in a distributed system.
  3. Design a simple distributed system for a web application.

Learning Objectives

  • Compare the advantages of a microservices architecture against a monolithic architecture for web applications.
  • Analyze the challenges of maintaining data consistency across multiple independent services in a distributed system.
  • Design a high-level architecture for a simple web application using a microservices approach.
  • Evaluate the trade-offs between scalability, resilience, and complexity when choosing a distributed system design.

Before You Start

Introduction to Networking Concepts

Why: Students need to understand basic network communication protocols and client-server models to grasp how distributed components interact.

Object-Oriented Programming

Why: Familiarity with concepts like encapsulation and modularity in OOP helps students understand how services can be self-contained units.

Web Application Fundamentals

Why: Understanding how web servers, clients, and databases interact provides a foundation for discussing distributed web architectures.

Key Vocabulary

Distributed SystemA system where components are located on different networked computers, which communicate and coordinate their actions by passing messages to achieve a common goal.
Microservices ArchitectureAn architectural style that structures an application as a collection of small, independent, and loosely coupled services, each running in its own process and communicating via lightweight mechanisms.
Monolithic ArchitectureAn architectural style where an application is built as a single, unified unit, with all components tightly integrated and deployed together.
ScalabilityThe ability of a system to handle a growing amount of work, or its potential to be enlarged to accommodate that growth, often by adding more resources.
ResilienceThe ability of a system to continue operating correctly, even in the presence of faults or failures, such as network issues or service outages.

Watch Out for These Misconceptions

Common MisconceptionDistributed systems are always faster than monolithic ones.

What to Teach Instead

Network latency and communication overhead often slow distributed systems. Hands-on simulations where students measure response times before and after distribution reveal these costs, helping them evaluate real performance trade-offs through data collection and comparison.

Common MisconceptionMicroservices eliminate all single points of failure.

What to Teach Instead

Dependencies like shared databases can still create vulnerabilities. Group prototyping activities expose these when one service fails, prompting discussions on circuit breakers and redundancy, which clarify resilience limits.

Common MisconceptionData consistency is automatic in microservices.

What to Teach Instead

Services often use eventual consistency due to distribution challenges. Labs tracking replicated data updates show discrepancies, and peer teaching reinforces strategies like two-phase commits, building accurate mental models.

Active Learning Ideas

See all activities

Real-World Connections

  • Software engineers at Netflix use microservices to manage their vast streaming platform, allowing them to independently update and scale services like recommendation engines or video playback.
  • Financial technology companies, such as Stripe, employ distributed systems to process millions of secure online payments, ensuring high availability and fault tolerance for their critical services.
  • E-commerce giants like Amazon utilize microservices to handle diverse functions, from product catalog management and order processing to inventory tracking and customer reviews, enabling rapid feature deployment.

Assessment Ideas

Quick Check

Present students with two application scenarios: one requiring rapid feature iteration and high user concurrency, the other a small internal tool. Ask them to identify which scenario would benefit more from a microservices architecture and justify their choice with one specific reason.

Discussion Prompt

Pose the question: 'Imagine a distributed system where a user's profile service and order history service fail independently. What are two potential impacts on the user experience, and what strategy could mitigate one of these impacts?' Facilitate a class discussion on fault isolation and recovery.

Exit Ticket

On an index card, ask students to list one advantage of microservices over monoliths and one challenge of managing data consistency in a distributed system. They should provide a brief, one-sentence explanation for each.

Frequently Asked Questions

What are the main advantages of microservices over monolithic apps?
Microservices offer scalability by allowing independent scaling of services, resilience through isolated failures, and agility with separate deployment cycles. Students grasp this when comparing app performance under load; monolithic apps crash entirely, while microservices degrade gracefully, aligning with curriculum goals for analyzing architectures.
How do you manage data consistency in distributed systems?
Techniques include eventual consistency for high availability, sagas for distributed transactions, and consensus protocols like Raft. In class, students model these with shared tools, observing trade-offs: strong consistency slows systems, but eventual suits scalable apps like social media feeds.
How can active learning help students understand distributed systems?
Active approaches like building containerized prototypes or simulating network partitions give direct experience with challenges like latency and failures. Collaborative redesigns reveal why microservices excel in scalability, turning abstract theory into observable outcomes and deepening retention through trial and error.
What challenges arise when designing a simple distributed web app?
Key issues include service discovery, load balancing, and monitoring. Students address these in design activities by diagramming API gateways and using tools like Kubernetes basics, learning that poor orchestration leads to bottlenecks, essential for CS.SE.2 standards.