Advanced Distributed Systems
Advanced Distributed Systems
o Module Overview
o References
All placeholders [ ] are for instructors to add specific URLs or file names. The content is fully
expanded and ready to be copied into an LMS or printed.
Welcome to Advanced Distributed Systems. This course equips you with the principles and
practices of designing, developing, and evaluating modern distributed systems – from
microservices and containers to consensus algorithms and blockchain. You will learn through
lectures, hands-on labs, simulations, and a capstone project.
Instructor: [Your Name]
Email: [Your Email]
Response time: Within 48 hours
Virtual office hour: [Day, time, link placeholder]
Blended delivery: weekly asynchronous online modules on Moodle, plus optional synchronous
lab sessions for troubleshooting and project consultations.
Technical Requirements
Software: Docker Desktop, Minikube, Python 3, Go (optional), Git, Visual Studio Code
Technical Support
All work must be your own. Collaboration on lab reports and the final project is allowed, but
individual assignments and quizzes are strictly individual. Plagiarism will result in zero marks and
referral to the academic misconduct committee.
Netiquette Guidelines
Be constructive.
Component Weight
Assignments 15%
Total 100%
Late Submission Policy: 20% penalty within 48 hours; no submission after 48 hours without
documented emergency.
Prompt: State your name, background, and one distributed system you use daily (e.g., email,
cloud storage, social media). What do you think makes it “distributed”?
Grading: Part of participation (tracked separately, but contributes to overall engagement).
Materials
Activities
Install Docker and run docker run hello-world. Post a screenshot (ungraded, but required
for lab access).
Module Overview
This module explores the fundamental goals, architectures, and design challenges of distributed
systems. You will learn the differences between client-server and peer-to-peer models, compare
monolithic and microservice architectures, and get hands-on with Docker containers – the
building blocks of modern distributed applications.
Module weight: 10% of final grade (Quiz 3% + Lab Setup Report 2% + class participation)
Bloom’s
# Measurable Learning Objective
Level
Define the goals and characteristics of distributed systems (scalability, fault tolerance,
1.1 Understan
transparency, openness).
Bloom’s
# Measurable Learning Objective
Level
Differentiate monolithic from microservice architectures and justify the trade-offs for a
1.3 Analyze
given scenario.
Lesson 1 Illustrate distributed system structures and explain design trade-offs in scalability and fault toleran
Lesson 2 Set up a Docker container, run a simple service, and document the process.
Bloom’s
# Objective
Level
Define the key goals of a distributed system (resource sharing, openness, scalability,
1.1.1 Understan
fault tolerance, transparency).
1.1.3 Evaluate trade-offs between monolithic and microservice architectures for a given Evaluate
Bloom’s
# Objective
Level
application scenario.
Detailed Explanation:
In a distributed system, multiple autonomous nodes communicate via a network to achieve a
common goal. Key characteristics:
Independent failures – a node can fail without stopping the whole system.
Examples:
Resource
Hardware, software, data accessible from any node. Security, concurrency control.
sharing
Goal Description Challenge
Algorithmic bottlenecks,
Scalability System handles growth (users, nodes, data).
synchronisation.
Formative Assessment: Name one example of transparency in the World Wide Web. (Answer:
location transparency – you use a URL, not the server’s IP address.)
Definition – Client-Server: A few powerful servers provide services; many clients request them.
Detailed Explanation:
Cons: Single point of failure, limited scalability (server can become bottleneck).
Definition – Peer-to-Peer (P2P): Every node is both a client and a server; no central coordinator.
Detailed Explanation:
Comparison Table
Example of hybrid: BitTorrent (P2P for file transfer) uses trackers (client-server) for discovery.
Detailed Explanation:
Detailed Explanation:
Each service has its own bounded context, database, and deployment pipeline.
Comparison Table
Aspect Monolithic Microservices
Fault isolation Failure in one part can crash whole app Failure isolated to one service
Design Trade-offs:
Microservices are better for large, evolving systems with high scalability needs, but they
add network overhead, data consistency challenges, and operational complexity.
Formative Assessment: Suppose you are building an e-commerce site with a few thousand
users. Which architecture would you choose? Justify your answer in one sentence.
1.2.3 Run and manage Docker containers using basic commands. Apply
Detailed Explanation:
Unlike virtual machines (VMs) that run a full guest OS, containers are lightweight – they
start in seconds and use much less memory.
Containers are portable: they run identically on a developer’s laptop, a test server, or in
the cloud.
Command Purpose
text
FROM alpine:latest
Deliverable: Submit a PDF with screenshot and explanation. (2% of final grade)
Rubric (2 points): Screenshot (1), explanation clarity (1).
Definition: Docker Compose is a tool for defining and running multi-container Docker
applications using a YAML file.
yaml
version: '3'
services:
web:
build: .
ports:
- "5000:5000"
redis:
image: "redis:alpine"
Task (optional – not graded, but recommended): Install Docker Compose and run the official
quickstart example from Docker docs.
Formative Assessment: Explain why an orchestration tool like Compose is needed for
microservices.
Activity Compare client-server and P2P for a file-sharing app. Write 150 words. Submit to
Analyze
1 Discussion Forum 1.1.
Activity Hands-o Build and run a Docker container that prints your name and course. Submit screens
2 n as part of Lab Setup Report.
Peer review: Exchange Dockerfile and screenshot with a partner; verify correctness.
2. True or False: In a pure client-server architecture, the server can become a bottleneck.
3. Which architecture is more suitable for a system that must survive the failure of any
single node? a) client-server b) peer-to-peer c) monolithic d) three-tier
(Full quiz on Moodle.)
References (Module 1)
Coulouris, G., Dollimore, J., Kindberg, T., & Blair, G. (2011). Distributed Systems: Concepts
and Design (5th ed.). Addison-Wesley. (Chapter 1)
Tanenbaum, A. S., & Van Steen, M. (2017). Distributed Systems: Principles and
Paradigms (3rd ed.). (Chapter 1)
End of Module 1
(Modules 2–7 follow the same detailed structure. For brevity, I will now present the remaining
modules in a condensed but fully detailed form – each unit includes definitions, explanations,
tables, tasks, discussion prompts, formative assessments, graded assessments with rubrics, and
references. The structure is identical to Module 1.)
Module Overview
This module covers logical clocks, mutual exclusion, leader election, and consensus algorithms –
the building blocks for coordination in distributed systems. You will implement Lamport clocks,
simulate Ricart-Agrawala and Bully algorithms, and run a RAFT consensus simulation.
2.1 Apply Lamport and vector clocks to order events in distributed computations. Apply
2.4 Evaluate the RAFT consensus protocol in terms of safety and liveness. Evaluate
Definition: In a distributed system, each node has its own physical clock. Even with perfect
synchronisation, clocks drift. Logical clocks provide a way to order events without global time.
Detailed Explanation:
Lamport defined the happens-before relation (→):
If a and b are events in the same process and a occurs before b, then a → b.
Readings:
[PDF] Lamport’s paper “Time, Clocks and the Ordering of Events” – [Link]
Definition: A vector clock is an array of integers, one per process. It captures causality more
precisely than Lamport clocks – it can detect concurrent events.
Detailed Explanation:
Each process i maintains V[i] as its own counter, and V[j] for others as the last known value. On
internal event: V[i]++; on send: send the whole vector; on receive: merge (take element-wise
max) then increment own entry.
Example diagram (described): Two processes P1 and P2 exchange messages. A table shows
vector clocks before and after each event.
Formative Assessment: Given a sequence of events, determine whether two events are
concurrent using vector clocks.
Discussion Forum 2.1: Post a Lamport clock trace for a simple send-receive scenario. Reply to a
peer who has a different ordering – explain which event order is correct.
Definition: A protocol that allows processes to enter a critical section without a central
coordinator.
Detailed Explanation:
A process requesting entry sends a “request” message to all other processes, with its
own Lamport timestamp.
A process responds “OK” if it is not in the critical section and has not requested with a
higher timestamp.
Formative Assessment: What happens if a process crashes after sending some OK replies?
(Possible deadlock – need timeout and recovery.)
Definition: In a system where processes have unique IDs, the Bully algorithm elects the
highest-ID process as leader.
Detailed Explanation:
Any process can start an election by sending an ELECTION message to all processes with
higher ID.
If no higher process responds, it declares itself leader and sends COORDINATOR to all.
If a higher process responds, it takes over and runs its own election.
Simulation lab: Implement the Bully algorithm in Python (or use an online simulator). Test with
5 nodes and random crashes.
Lab Report (5%): Simulate the Bully algorithm with 5 processes. Create a timeline diagram
showing election messages. Write a 300-word analysis of the algorithm’s performance under
different failure scenarios.
Rubric (5 points): Simulation correctness (2), diagram (1), analysis (2).
Properties: Agreement (no two processes decide differently), validity (decided value was
proposed), termination (all non-faulty processes eventually decide).
Readings:
Log replication: Leader accepts client commands, appends to its log, sends
AppendEntries RPCs to followers.
Visualisation: Use the RAFT interactive demo (by Stanford). Students experiment with partitions
and leader changes.
Assignment (5%): Using the RAFT simulation app, run three scenarios: (a) stable leader, (b)
leader partition, (c) follower crash and recovery. Capture screenshots and write a 500-word
analysis comparing RAFT with basic Paxos (from reading).
Rubric (5 points): Scenario coverage (1.5), correctness of observations (2), analysis depth (1.5).
Questions:
2. Can vector clocks tell us that two events are concurrent? How?
3. In the Bully algorithm, what happens if the highest-ID process fails immediately after
being elected?
Module Overview
This module examines the CAP theorem, consistency models (strong vs. eventual), quorum
systems, and replication strategies. You will analyse trade-offs between consistency, availability,
and partition tolerance, configure replication in a distributed database, and simulate failure
recovery.
Bloom’s
# Measurable Learning Objective
Level
Analyze the CAP theorem and classify distributed systems according to their
3.1 Analyze
consistency/availability trade-offs.
Definition: The CAP theorem (Brewer’s theorem) states that a distributed system cannot
simultaneously provide Consistency, Availability, and Partition tolerance. It can choose at most
two.
Detailed Explanation:
Partition tolerance: The system continues to operate despite arbitrary message loss or
delay between nodes.
In practice, networks always have partitions (P). Therefore, a distributed system must choose
between CP (consistency + partition tolerance) and AP (availability + partition tolerance).
Examples:
Diagram described (text): A triangle with vertices C, A, P. CP systems at the C-P edge, AP
systems at the A-P edge.
Formative Assessment: If a network partition occurs, which two properties can a CP system
guarantee? (Consistency and Partition tolerance; availability may be sacrificed.)
Definition – Strong consistency (linearizability): After a write, all subsequent reads see that
write (or a later one). The system behaves as if there were only one copy.
Definition – Eventual consistency: Updates will propagate to all replicas eventually, but reads
may see stale data for a window. No guarantee of immediate visibility.
Comparison Table
Aspect Strong Consistency Eventual Consistency
Write availability Lower (needs sync) Higher (local write, async replication)
Use cases Bank accounts, inventories Social media feeds, shopping carts
Formative Assessment: Why would an e-commerce site use eventual consistency for a “like”
button but strong consistency for inventory deduction?
Definition: A quorum is the minimum number of replicas that must participate in a read or
write operation to guarantee consistency.
Detailed Explanation:
Rule: R + W > N ensures that a read will see at least one version of the latest write (no
stale reads).
Quorum configurations:
High write availability (W=1, R=N): writes fast, reads slow and consistent.
Definition: One replica is designated primary (master); all writes go to the primary, which
propagates updates to backups (slaves). Reads can go to any replica (if eventual consistency) or
only to primary (for strong consistency).
Detailed Explanation:
Failure handling: If primary fails, a backup is promoted (often via leader election – see Module
2).
Lab Task (part of lab report): Use MySQL replication or Redis Sentinel to set up primary-backup.
Simulate primary crash and observe failover time. Measure write throughput under
synchronous vs. asynchronous mode.
Definition: All replicas accept writes concurrently; conflicts are resolved using techniques like
last-write-wins, vector clocks, mergeable data structures (CRDTs).
Detailed Explanation:
Formative Assessment: What is a CRDT? Give one example. (Conflict-free Replicated Data Type;
e.g., G-Counter, ORSet.)
Lab Report (5%): Using Cassandra (or a simpler key-value store like RIAK) with N=3, W=2, R=2:
3. Query all keys from remaining two replicas. Record success rate.
6. Write a 500-word report with your observations, including consistency during failure and
recovery time.
Rubric (5 points): Setup description (1), experiment execution (2), results & analysis (2).
1. What is the trade-off between choosing W=1 and W=N in quorum replication?
2. Name one scenario where availability is more important than consistency. (Answer: DNS,
social media likes)
Module Overview
This module covers failure models, checkpointing, Byzantine faults, and consensus-based fault
tolerance using Paxos and RAFT. You will distinguish between crash and Byzantine faults,
evaluate Paxos performance, and simulate crash recovery scenarios.
Module weight: 15% (Midterm Exam 15% + Lab Report 5% – NOTE: midterm is within this
module, not separate; we keep as per original: Midterm Exam 15% covers modules 1-4? But per
module table: Module 4 includes midterm. We'll follow the original.)
Actually the grading summary says Midterm Exam 15% (separate component). We'll list as
assessed within Module 4.
4.1 Differentiate crash failures, omission failures, and Byzantine failures. Analyze
4.2 Explain the role of checkpointing and logging in crash recovery. Understand
4.3 Evaluate the Paxos consensus algorithm for fault tolerance. Evaluate
4.4 Simulate crash recovery using checkpointing and log replay. Apply
# Measurable Learning Objective Bloom’s Level
Definition – Crash failure: A process stops executing; it does not perform any further steps. No
byzantine behaviour.
Definition – Omission failure: A process fails to send or receive messages (e.g., network drop).
Table
Readings:
[PDF] “Introduction to Fault Tolerance” – [Link]
Formative Assessment: If a process sends different values to different replicas, what failure type
is that? (Byzantine)
Definition – Log: A record of events (e.g., state changes, messages) since the last checkpoint.
Recovery: After crash, restart from latest checkpoint and replay log entries.
Coordinated: all processes checkpoint together – easy but requires global sync.
Formative Assessment: What is the domino effect? (Recovery may force cascading rollbacks to
previous checkpoints, possibly back to initial state.)
Definition: Paxos is a family of consensus algorithms that allow distributed nodes to agree on a
single value even if some fail (crash failures).
Roles: Proposer (suggests a value), Acceptor (votes), Learner (learns the decided value).
Phase 1 (Prepare): Proposer sends a prepare request with a proposal number. Acceptors
respond promising not to accept lower-numbered proposals.
Phase 2 (Accept): Proposer sends accept request with value. Acceptors accept if they
haven't promised higher.
Discussion Forum 4.1 (Graded): Compare Paxos and RAFT (from Module 2). Which is easier to
reason about? Why? Post 200 words; reply to two peers.
Lab Report (5%): Use a Paxos simulation (e.g., online app or provided Python script). Run
scenarios:
One acceptor crashes after prepare phase; observe if consensus still reached.
Midterm Exam (15%) – covers Modules 1-4. Format: 2 hours, case-based short answers and
algorithm design. Sample: Design a quorum system for a banking application; analyse CAP
trade-offs. (Full exam on Moodle.)
Module Overview
This module explores middleware platforms (CORBA, gRPC, Spring Cloud) and container
orchestration with Docker and Kubernetes. You will design scalable service-oriented systems,
use gRPC for inter-service communication, and deploy distributed services using containers.
Module weight: 15% (Design Assignment 5% + Lab Report 5% + Quiz 3% + class participation)
Module Learning Objectives
5.1 Compare different middleware approaches (RPC, message queues, service mesh). Analyze
Generations:
Comparison Table
Formative Assessment: Why would you use gRPC instead of REST for a low-latency
microservice? (Answer: HTTP/2 multiplexing, binary payload, streaming.)
Readings:
Lab Report (5%): Write a step-by-step guide with screenshots, including proto file, server code,
client code, Dockerfile for each, and [Link] to run both. Include an analysis of
gRPC’s performance advantages.
Rubric (5 points): Proto definition (1), server/client implementation (2), Docker setup (1),
analysis (1).
yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: myapp
spec:
replicas: 3
selector:
matchLabels:
app: myapp
template:
metadata:
labels:
app: myapp
spec:
containers:
- name: myapp
image: myapp:v1
ports:
- containerPort: 8080
Design Assignment (5%): Write Kubernetes YAML for a multi-service application (frontend +
backend + Redis). Include Deployment, Service (ClusterIP for backend, LoadBalancer for
frontend), and ConfigMap for environment variables.
Rubric (5 points): Deployment correctness (2), Service definitions (2), ConfigMap usage (1).
Module Overview
This module explores decentralized networks: edge computing (processing at the network edge)
and blockchain (distributed ledger). You will analyse edge vs. cloud, develop smart contracts,
and deploy a simple DApp.
6.1 Analyze trade-offs between cloud, fog, and edge computing. Analyze
6.4 Design a minimal decentralised application (DApp) using Ethereum and IPFS. Create
Lesson 1 Compare edge computing and cloud computing for an IoT scenario.
Definitions:
Edge: Data processing at the source (sensors, cameras, mobile devices) – minimal
latency, limited resources.
Comparison Table
Use case: Autonomous vehicle – must use edge (sub-10 ms). Video surveillance – edge filters,
cloud stores.
Readings:
Task: Install EdgeX Foundry (Docker compose). Run the device virtual service. Observe data flow
from device service to core data to application service. Write a 100-word summary (part of
mini-project).
Definition: A distributed, immutable ledger that maintains a growing list of records (blocks)
linked via cryptography.
Readings:
Definition: Self-executing contracts with the terms directly written into code.
solidity
contract SimpleStorage {
uint storedData;
Lab hands-on: Use Remix IDE, compile, deploy to Ganache (local testnet). Interact via [Link].
Mini-Project (10%):
Task: Build a decentralised application (DApp) that stores data on Ethereum (Ropsten testnet)
and references a file on IPFS. Provide:
Rubric (10 points): Contract correctness (3), frontend functionality (2), IPFS integration (2),
explanation (3).
Module Overview
This capstone module integrates all course concepts. Students work in teams to architect,
implement, and present a distributed system that demonstrates fault tolerance, scalability, and
modern middleware or blockchain.
Bloom’s
# Measurable Learning Objective
Level
Design a distributed system addressing a real problem (e.g., decentralised chat, edge
7.1 Create
monitoring, replicated key-value store).
7.3 Evaluate the system’s performance, fault tolerance, and scalability. Evaluate
7.4 Present the design and results in a written report and oral defence. Create
Bloom’s
# Measurable Learning Objective
Level
Task (Week 12): Submit a 1-page proposal: problem, proposed solution, technologies (Docker,
gRPC, RAFT, Ethereum, etc.), team members.
1. Abstract (1 para)
Format: 15-min recorded video (or live) + 5 min Q&A (instructor). All team members present.
Rubric (5 points):
Q&A (1)
Peer evaluation: Each team member rates peers confidentially (affects individual component of
presentation grade).
Format: 2 hours, comprehensive, covering all modules. Case-based questions requiring analysis,
design, and justification.
Sample questions:
Given a scenario (e.g., social network with 1 billion users), propose a replication strategy
and justify using CAP theorem.
Design a smart contract for a decentralised voting system; discuss security pitfalls.