SlideShare a Scribd company logo
1 of 30
Download to read offline
Distributed Systems 1, Columbia Course 4113, Instructor: Roxana Geambasu
Distributed Systems 1
CUCS Course 4113
https://systems.cs.columbia.edu/ds1-class/
Instructor: Roxana Geambasu
1
Distributed Systems 1, Columbia Course 4113, Instructor: Roxana Geambasu
Distributed Systems Primer
2
Distributed Systems 1, Columbia Course 4113, Instructor: Roxana Geambasu
Outline
• Challenges, Goals, and Approaches for DS
• Example: Web Service Architecture
3
Distributed Systems 1, Columbia Course 4113, Instructor: Roxana Geambasu
Outline
• Challenges, Goals, and Approaches for DS
• Example: Web Service Architecture
4
Distributed Systems 1, Columbia Course 4113, Instructor: Roxana Geambasu
Context
• Distribution is hard, for many reasons.
• Distributed Systems (DS) aim to provide the core
mechanisms that address the challenges and hide them
under abstractions.
• Not all challenges can be hidden, so DS developers and
users must understand the challenges and approaches to
address them.
• Next we’ll talk about some of the challenges, goals, and
approaches in DS design.
5
Distributed Systems 1, Columbia Course 4113, Instructor: Roxana Geambasu
Challenge 1: Ever-Growing Load
• Data is big. Users are many. Requests
are even more. No single machine can
handle the ever-growing load.
• A primary goal of DSes is to enable
“multiple independent machines
interconnected through a network to
coordinate to achieve a common,
consistent service or function.”
• But effective coordination at scale is hard!
6
net-
work
M1 M2
M5 M4
M3
Mn
Distributed Systems 1, Columbia Course 4113, Instructor: Roxana Geambasu
Goal 1: Scalability
• The more resource you add, the more data you should be
able to store/process, and the more users you should be able
to serve.
• But never hope for perfect scalability: add one machine,
increase your capacity proportionally forever.
– Most often, the scalability curve tapers off as various components of the
system start to reach their capacities (maximum handled load/unit of
time, e.g., max number of requests completed per second).
– Components that limit scalability are called bottlenecks and sometimes
they can be very hidden (logging server, network router).
7
Distributed Systems 1, Columbia Course 4113, Instructor: Roxana Geambasu
Sample Scalability Curves
# machines
Capacity
(handled
load/time)
A
1
C
B
8
POLL TIME!
Distributed Systems 1, Columbia Course 4113, Instructor: Roxana Geambasu
Approach 1: Sharding
• Launch multiple processes (a.k.a., workers), split up your
load into pieces (a.k.a., shards), and assign different shards
to different workers.
• The workers should be designed to coordinate to achieve a
common, consistent service despite the sharding.
• Unfortunately, sharding raises semantic challenges esp. with
failures.
9
Distributed Systems 1, Columbia Course 4113, Instructor: Roxana Geambasu
Challenge 2:
At Scale, Failures Are Inevitable
10
• Many types of failures:
• network, machine (software, hardware, flipped bits in memory,..), datacenter,…
• some are small and isolated, others are major failures
• some are persistent, others are temporary
• some resolve themselves, others require human intervention …
• At scale, failures are almost guaranteed to occur all the time,
and most of them occur at unpredictable times.
• The big challenge is that failures greatly challenge coordination
between the machines of a distributed systems.
Distributed Systems 1, Columbia Course 4113, Instructor: Roxana Geambasu
Goal 2: Fault Tolerance
• Goal is to hide failures as much as possible to provide a service
that e.g., finishes the computation fast despite failures, stores
some data reliably despite failures, …
• Fault tolerance subsumes:
– Availability: the service/data continues to be operational despite failures.
– Durability: some data or updates that have been acknowledged by the
system will persist despite failures and will eventually become available.
• Durability differs from availability: durability can be thought of as
“eventual availability” of some data or state.
11
Distributed Systems 1, Columbia Course 4113, Instructor: Roxana Geambasu
Approach 2: Replication
• Have multiple replicas execute/store the same shard; if one
replica dies, another replica can provide the data/computation.
• Example:
– Say you’re computing a maximum over a sharded dataset across
multiple workers.
– Have the maximum over each shard be computed by 2-3 replicas in
parallel.
– If one replica dies, another one can report the max to the other n-1
worker sets.
12
Distributed Systems 1, Columbia Course 4113, Instructor: Roxana Geambasu
Challenge 3: Consistency in Sharded and
Replicated Systems is HARD
• Example:
– Say we want to compute an exact average over a sharded and
replicated dataset.
– How do we make sure that we incorporate the average over each
shard only once if the average over each shard is computed and
reported by three replicas?
– Assigning each shard a unique ID may help, but what if the faulty
replica does not die, but instead spews up a faulty value due to,
e.g., memory error.
13
Distributed Systems 1, Columbia Course 4113, Instructor: Roxana Geambasu
Goal 3: Meaningful Consistency Semantics
• Dealing with these issues is hard for both the programmers and users.
• The goal is to build infrastructure systems (such as storage systems,
computation frameworks, etc.) that provide clear semantics that hold
in the face of failures, and to express those semantics clearly in APIs.
• Example:
– Say you decide that in case of failure your distributed computation system
will return the results of a partial computation.
– Then you need to communicate that through your API. You should also
provide error bounds for the results you are reporting. That’s semantic.
.14
Distributed Systems 1, Columbia Course 4113, Instructor: Roxana Geambasu
Approach 3: Rigorous Protocols
• The general approach is to develop rigorous protocols, which we
will generically call agreement protocols, that allow workers and
replicas to coordinate in a consistent way despite failures.
• Agreement protocols often rely on the notion of majorities: as
long as a majority agrees on a value, the idea is that it can be
safe to continue making that action.
• Different protocols exist for different consistency challenges, and
often the protocols can be composed to address bigger, more
realistic challenges.
15
Distributed Systems 1, Columbia Course 4113, Instructor: Roxana Geambasu
Outline
• Challenges, Goals, and Approaches for DS
• Example: Web Service Architecture
16
Distributed Systems 1, Columbia Course 4113, Instructor: Roxana Geambasu
Basic Architecture
Web front end (FE), database server (DB),
network. FE is stateless, all state in DB.
Properties:
• Scalability?
• Fault tolerance?
• Semantics?
• Performance?
17
Distributed Systems 1, Columbia Course 4113, Instructor: Roxana Geambasu
Basic Architecture
18
• Performance: poor.
• Fault tolerance: poor.
• Scalability: poor.
• Semantics (consistency): great!
Distributed Systems 1, Columbia Course 4113, Instructor: Roxana Geambasu
Basic Architecture
19
• Performance: poor.
• Fault tolerance: poor.
• Scalability: poor.
• Semantics (consistency): great!
First, let’s improve performance (latency).
Distributed Systems 1, Columbia Course 4113, Instructor: Roxana Geambasu
Goal: Reduce Latency
Web FE’s reads/writes go through
in-memory cache ($$).
• Performance?
– For reads?
– For writes?
• Fault tolerance?
– Availability?
– Durability?
• Scalability?
• Semantics/consistency?
20
Distributed Systems 1, Columbia Course 4113, Instructor: Roxana Geambasu
Goal: Reduce Latency
• Read latency: improved if working set fits in
memory.
• Durability: depends on cache: good for
write-through $$, poor for write-back $$.
• Write latency is opposite: good with write-back,
poor with write-through.
• Consistency: good: you have 1 FE accesses DB,
going through 1 $$, so behavior is equivalent to
single machine.
21
Distributed Systems 1, Columbia Course 4113, Instructor: Roxana Geambasu
Goal: Reduce Latency
Let’s deal with scalability, first on FE and later on DB.
22
• Read latency: improved if working set fits in
memory.
• Durability: depends on cache: good for
write-through $$, poor for write-back $$.
• Write latency is opposite: good with write-back,
poor with write-through.
• Consistency: good: you have 1 FE accesses DB,
going through 1 $$, so behavior is equivalent to
single machine.
Distributed Systems 1, Columbia Course 4113, Instructor: Roxana Geambasu
Goal: Scale Out the FE
(and get fault tolerance for it)
Launch multiple FEs. Each has
its own local cache, which we’ll
assume is write-through.
• Performance?
• Fault tolerance?
• Scalability?
• Semantics (consistency)?
23
Distributed Systems 1, Columbia Course 4113, Instructor: Roxana Geambasu
Goal: Fault Tolerance for DB
• Launch identical replicas of the
DB server, each with its disk. All
replicas hold all data, writes go
to all.
• Performance?
• Fault tolerance?
• Scalability?
• Semantics (consistency)?
24
BREAKOUT
Distributed Systems 1, Columbia Course 4113, Instructor: Roxana Geambasu
Goal: Fault Tolerance for DB
• Writes now need to propagate to all
replicas. So they are much slower!
Even if done in parallel, because FE
now needs to wait for the slowest of DB
replicas to commit (assuming
write-through cache, which offers the
best durability).
• All replicas must see all writes IN THE
SAME ORDER! If order is exchanged,
they can quickly go “out of sync”! So
lots more consistency issues.
25
Distributed Systems 1, Columbia Course 4113, Instructor: Roxana Geambasu
Goal: Fault Tolerance for DB
• There are also availability issues. If you
require all the replicas to be available
when a write is satisfied (for durability),
availability goes DOWN! Consensus
protocols, which work on a majority of
replicas, address this.
• Another consistency challenge: how are
reads handled? If you read from one
replica, which one should you read given
that updates to the item you’re interested
in might be in flight as you attempt to read
it? We’ll address these issues in future
lectures by structuring the replica set. 26
Distributed Systems 1, Columbia Course 4113, Instructor: Roxana Geambasu
Goal: Fault Tolerance for DB
• There are also availability issues. If you
require all the replicas to be available
when a write is satisfied (for durability),
availability goes DOWN! Consensus
protocols, which work on a majority of
replicas, address this.
• Another consistency challenge: how are
reads handled? If you read from one
replica, which one should you read given
that updates to the item you’re interested
in might be in flight as you attempt to read
it? We’ll address these issues in future
lectures by structuring the replica set. 27
Let’s deal with DB scalability.
Distributed Systems 1, Columbia Course 4113, Instructor: Roxana Geambasu
Last Goal: Scale Out the DB
Partition the database into multiple
shards, replicate each multiple times
for fault tolerance. Requests for
different shards go to different replica
groups.
• Performance?
• Fault tolerance?
• Scalability?
• Semantics (consistency)?
28
Distributed Systems 1, Columbia Course 4113, Instructor: Roxana Geambasu
New challenges that arise:
• How should data be sharded? Based on
users, on some property of the data?
• How should different partitions get assigned
to replica groups? How do clients know
which servers serve/store which shards?
• If the FE wants to write/read multiple entries
in the DB, how can it do that atomically if
they span multiple shards? If different
replica groups need to coordinate to
implement atomic updates across shards,
won’t that hinder scalability?
29
Final Goal: Scale Out the DB
Distributed Systems 1, Columbia Course 4113, Instructor: Roxana Geambasu
Take-Aways
• Scalability, fault tolerance, consistency, and
performance are difficult goals to achieve together.
• Solving them requires rigorous protocols and system
architectures.
• This class teaches such protocols and architectures,
plus how they are incorporated in real systems.
30

More Related Content

Similar to 01-distributed-systems-primer.pdf

CAP Theorem and Split Brain Syndrome
CAP Theorem and Split Brain SyndromeCAP Theorem and Split Brain Syndrome
CAP Theorem and Split Brain SyndromeDilum Bandara
 
Mc0085 advanced operating systems (distributed
Mc0085  advanced operating systems (distributedMc0085  advanced operating systems (distributed
Mc0085 advanced operating systems (distributedsmumbahelp
 
Reading Notes : the practice of programming
Reading Notes : the practice of programmingReading Notes : the practice of programming
Reading Notes : the practice of programmingJuggernaut Liu
 
Improving Software Quality Using Object Oriented Design Principles
Improving Software Quality Using Object Oriented Design PrinciplesImproving Software Quality Using Object Oriented Design Principles
Improving Software Quality Using Object Oriented Design PrinciplesDr. Syed Hassan Amin
 
CAP Theorem - Theory, Implications and Practices
CAP Theorem - Theory, Implications and PracticesCAP Theorem - Theory, Implications and Practices
CAP Theorem - Theory, Implications and PracticesYoav Francis
 
Scaling apps for the big time
Scaling apps for the big timeScaling apps for the big time
Scaling apps for the big timeproitconsult
 
Distributed RDBMS: Challenges, Solutions & Trade-offs
Distributed RDBMS: Challenges, Solutions & Trade-offsDistributed RDBMS: Challenges, Solutions & Trade-offs
Distributed RDBMS: Challenges, Solutions & Trade-offsAhmed Magdy Ezzeldin, MSc.
 
Lecture 2 more about parallel computing
Lecture 2   more about parallel computingLecture 2   more about parallel computing
Lecture 2 more about parallel computingVajira Thambawita
 
Big Data Day LA 2015 - Lessons Learned from Designing Data Ingest Systems by ...
Big Data Day LA 2015 - Lessons Learned from Designing Data Ingest Systems by ...Big Data Day LA 2015 - Lessons Learned from Designing Data Ingest Systems by ...
Big Data Day LA 2015 - Lessons Learned from Designing Data Ingest Systems by ...Data Con LA
 
The Hows and Whys of a Distributed SQL Database - Strange Loop 2017
The Hows and Whys of a Distributed SQL Database - Strange Loop 2017The Hows and Whys of a Distributed SQL Database - Strange Loop 2017
The Hows and Whys of a Distributed SQL Database - Strange Loop 2017Alex Robinson
 
Concurrency Programming in Java - 01 - Introduction to Concurrency Programming
Concurrency Programming in Java - 01 - Introduction to Concurrency ProgrammingConcurrency Programming in Java - 01 - Introduction to Concurrency Programming
Concurrency Programming in Java - 01 - Introduction to Concurrency ProgrammingSachintha Gunasena
 
Challenges in Large Scale Machine Learning
Challenges in Large Scale  Machine LearningChallenges in Large Scale  Machine Learning
Challenges in Large Scale Machine LearningSudarsun Santhiappan
 
Challenges in Optimizing Job Scheduling on Mesos
Challenges in Optimizing Job Scheduling on MesosChallenges in Optimizing Job Scheduling on Mesos
Challenges in Optimizing Job Scheduling on MesosAlex D. Gaudio
 
Patterns of enterprise application architecture
Patterns of enterprise application architecturePatterns of enterprise application architecture
Patterns of enterprise application architectureChinh Ngo Nguyen
 
Challenges in Querying a Distributed Relational Database
Challenges in Querying a Distributed Relational DatabaseChallenges in Querying a Distributed Relational Database
Challenges in Querying a Distributed Relational DatabaseScaleBase
 

Similar to 01-distributed-systems-primer.pdf (20)

CAP Theorem and Split Brain Syndrome
CAP Theorem and Split Brain SyndromeCAP Theorem and Split Brain Syndrome
CAP Theorem and Split Brain Syndrome
 
Mc0085 advanced operating systems (distributed
Mc0085  advanced operating systems (distributedMc0085  advanced operating systems (distributed
Mc0085 advanced operating systems (distributed
 
Reading Notes : the practice of programming
Reading Notes : the practice of programmingReading Notes : the practice of programming
Reading Notes : the practice of programming
 
Improving Software Quality Using Object Oriented Design Principles
Improving Software Quality Using Object Oriented Design PrinciplesImproving Software Quality Using Object Oriented Design Principles
Improving Software Quality Using Object Oriented Design Principles
 
CAP Theorem - Theory, Implications and Practices
CAP Theorem - Theory, Implications and PracticesCAP Theorem - Theory, Implications and Practices
CAP Theorem - Theory, Implications and Practices
 
Hbase hivepig
Hbase hivepigHbase hivepig
Hbase hivepig
 
Hbase hive pig
Hbase hive pigHbase hive pig
Hbase hive pig
 
Scaling apps for the big time
Scaling apps for the big timeScaling apps for the big time
Scaling apps for the big time
 
Distributed RDBMS: Challenges, Solutions & Trade-offs
Distributed RDBMS: Challenges, Solutions & Trade-offsDistributed RDBMS: Challenges, Solutions & Trade-offs
Distributed RDBMS: Challenges, Solutions & Trade-offs
 
02-map-reduce.pdf
02-map-reduce.pdf02-map-reduce.pdf
02-map-reduce.pdf
 
Lecture 2 more about parallel computing
Lecture 2   more about parallel computingLecture 2   more about parallel computing
Lecture 2 more about parallel computing
 
MongoDB
MongoDBMongoDB
MongoDB
 
Big Data Day LA 2015 - Lessons Learned from Designing Data Ingest Systems by ...
Big Data Day LA 2015 - Lessons Learned from Designing Data Ingest Systems by ...Big Data Day LA 2015 - Lessons Learned from Designing Data Ingest Systems by ...
Big Data Day LA 2015 - Lessons Learned from Designing Data Ingest Systems by ...
 
The Hows and Whys of a Distributed SQL Database - Strange Loop 2017
The Hows and Whys of a Distributed SQL Database - Strange Loop 2017The Hows and Whys of a Distributed SQL Database - Strange Loop 2017
The Hows and Whys of a Distributed SQL Database - Strange Loop 2017
 
Concurrency Programming in Java - 01 - Introduction to Concurrency Programming
Concurrency Programming in Java - 01 - Introduction to Concurrency ProgrammingConcurrency Programming in Java - 01 - Introduction to Concurrency Programming
Concurrency Programming in Java - 01 - Introduction to Concurrency Programming
 
Challenges in Large Scale Machine Learning
Challenges in Large Scale  Machine LearningChallenges in Large Scale  Machine Learning
Challenges in Large Scale Machine Learning
 
Database Management System
Database Management SystemDatabase Management System
Database Management System
 
Challenges in Optimizing Job Scheduling on Mesos
Challenges in Optimizing Job Scheduling on MesosChallenges in Optimizing Job Scheduling on Mesos
Challenges in Optimizing Job Scheduling on Mesos
 
Patterns of enterprise application architecture
Patterns of enterprise application architecturePatterns of enterprise application architecture
Patterns of enterprise application architecture
 
Challenges in Querying a Distributed Relational Database
Challenges in Querying a Distributed Relational DatabaseChallenges in Querying a Distributed Relational Database
Challenges in Querying a Distributed Relational Database
 

Recently uploaded

The Entity-Relationship Model(ER Diagram).pptx
The Entity-Relationship Model(ER Diagram).pptxThe Entity-Relationship Model(ER Diagram).pptx
The Entity-Relationship Model(ER Diagram).pptxMANASINANDKISHORDEOR
 
Autodesk Construction Cloud (Autodesk Build).pptx
Autodesk Construction Cloud (Autodesk Build).pptxAutodesk Construction Cloud (Autodesk Build).pptx
Autodesk Construction Cloud (Autodesk Build).pptxMustafa Ahmed
 
litvinenko_Henry_Intrusion_Hong-Kong_2024.pdf
litvinenko_Henry_Intrusion_Hong-Kong_2024.pdflitvinenko_Henry_Intrusion_Hong-Kong_2024.pdf
litvinenko_Henry_Intrusion_Hong-Kong_2024.pdfAlexander Litvinenko
 
Raashid final report on Embedded Systems
Raashid final report on Embedded SystemsRaashid final report on Embedded Systems
Raashid final report on Embedded SystemsRaashidFaiyazSheikh
 
CLOUD COMPUTING SERVICES - Cloud Reference Modal
CLOUD COMPUTING SERVICES - Cloud Reference ModalCLOUD COMPUTING SERVICES - Cloud Reference Modal
CLOUD COMPUTING SERVICES - Cloud Reference ModalSwarnaSLcse
 
Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)Ramkumar k
 
Research Methodolgy & Intellectual Property Rights Series 1
Research Methodolgy & Intellectual Property Rights Series 1Research Methodolgy & Intellectual Property Rights Series 1
Research Methodolgy & Intellectual Property Rights Series 1T.D. Shashikala
 
analog-vs-digital-communication (concept of analog and digital).pptx
analog-vs-digital-communication (concept of analog and digital).pptxanalog-vs-digital-communication (concept of analog and digital).pptx
analog-vs-digital-communication (concept of analog and digital).pptxKarpagam Institute of Teechnology
 
Final DBMS Manual (2).pdf final lab manual
Final DBMS Manual (2).pdf final lab manualFinal DBMS Manual (2).pdf final lab manual
Final DBMS Manual (2).pdf final lab manualBalamuruganV28
 
Artificial intelligence presentation2-171219131633.pdf
Artificial intelligence presentation2-171219131633.pdfArtificial intelligence presentation2-171219131633.pdf
Artificial intelligence presentation2-171219131633.pdfKira Dess
 
Circuit Breakers for Engineering Students
Circuit Breakers for Engineering StudentsCircuit Breakers for Engineering Students
Circuit Breakers for Engineering Studentskannan348865
 
Working Principle of Echo Sounder and Doppler Effect.pdf
Working Principle of Echo Sounder and Doppler Effect.pdfWorking Principle of Echo Sounder and Doppler Effect.pdf
Working Principle of Echo Sounder and Doppler Effect.pdfSkNahidulIslamShrabo
 
UNIT 4 PTRP final Convergence in probability.pptx
UNIT 4 PTRP final Convergence in probability.pptxUNIT 4 PTRP final Convergence in probability.pptx
UNIT 4 PTRP final Convergence in probability.pptxkalpana413121
 
UNIT-2 image enhancement.pdf Image Processing Unit 2 AKTU
UNIT-2 image enhancement.pdf Image Processing Unit 2 AKTUUNIT-2 image enhancement.pdf Image Processing Unit 2 AKTU
UNIT-2 image enhancement.pdf Image Processing Unit 2 AKTUankushspencer015
 
8th International Conference on Soft Computing, Mathematics and Control (SMC ...
8th International Conference on Soft Computing, Mathematics and Control (SMC ...8th International Conference on Soft Computing, Mathematics and Control (SMC ...
8th International Conference on Soft Computing, Mathematics and Control (SMC ...josephjonse
 
Tembisa Central Terminating Pills +27838792658 PHOMOLONG Top Abortion Pills F...
Tembisa Central Terminating Pills +27838792658 PHOMOLONG Top Abortion Pills F...Tembisa Central Terminating Pills +27838792658 PHOMOLONG Top Abortion Pills F...
Tembisa Central Terminating Pills +27838792658 PHOMOLONG Top Abortion Pills F...drjose256
 
Augmented Reality (AR) with Augin Software.pptx
Augmented Reality (AR) with Augin Software.pptxAugmented Reality (AR) with Augin Software.pptx
Augmented Reality (AR) with Augin Software.pptxMustafa Ahmed
 
Insurance management system project report.pdf
Insurance management system project report.pdfInsurance management system project report.pdf
Insurance management system project report.pdfKamal Acharya
 
What is Coordinate Measuring Machine? CMM Types, Features, Functions
What is Coordinate Measuring Machine? CMM Types, Features, FunctionsWhat is Coordinate Measuring Machine? CMM Types, Features, Functions
What is Coordinate Measuring Machine? CMM Types, Features, FunctionsVIEW
 
Filters for Electromagnetic Compatibility Applications
Filters for Electromagnetic Compatibility ApplicationsFilters for Electromagnetic Compatibility Applications
Filters for Electromagnetic Compatibility ApplicationsMathias Magdowski
 

Recently uploaded (20)

The Entity-Relationship Model(ER Diagram).pptx
The Entity-Relationship Model(ER Diagram).pptxThe Entity-Relationship Model(ER Diagram).pptx
The Entity-Relationship Model(ER Diagram).pptx
 
Autodesk Construction Cloud (Autodesk Build).pptx
Autodesk Construction Cloud (Autodesk Build).pptxAutodesk Construction Cloud (Autodesk Build).pptx
Autodesk Construction Cloud (Autodesk Build).pptx
 
litvinenko_Henry_Intrusion_Hong-Kong_2024.pdf
litvinenko_Henry_Intrusion_Hong-Kong_2024.pdflitvinenko_Henry_Intrusion_Hong-Kong_2024.pdf
litvinenko_Henry_Intrusion_Hong-Kong_2024.pdf
 
Raashid final report on Embedded Systems
Raashid final report on Embedded SystemsRaashid final report on Embedded Systems
Raashid final report on Embedded Systems
 
CLOUD COMPUTING SERVICES - Cloud Reference Modal
CLOUD COMPUTING SERVICES - Cloud Reference ModalCLOUD COMPUTING SERVICES - Cloud Reference Modal
CLOUD COMPUTING SERVICES - Cloud Reference Modal
 
Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)
 
Research Methodolgy & Intellectual Property Rights Series 1
Research Methodolgy & Intellectual Property Rights Series 1Research Methodolgy & Intellectual Property Rights Series 1
Research Methodolgy & Intellectual Property Rights Series 1
 
analog-vs-digital-communication (concept of analog and digital).pptx
analog-vs-digital-communication (concept of analog and digital).pptxanalog-vs-digital-communication (concept of analog and digital).pptx
analog-vs-digital-communication (concept of analog and digital).pptx
 
Final DBMS Manual (2).pdf final lab manual
Final DBMS Manual (2).pdf final lab manualFinal DBMS Manual (2).pdf final lab manual
Final DBMS Manual (2).pdf final lab manual
 
Artificial intelligence presentation2-171219131633.pdf
Artificial intelligence presentation2-171219131633.pdfArtificial intelligence presentation2-171219131633.pdf
Artificial intelligence presentation2-171219131633.pdf
 
Circuit Breakers for Engineering Students
Circuit Breakers for Engineering StudentsCircuit Breakers for Engineering Students
Circuit Breakers for Engineering Students
 
Working Principle of Echo Sounder and Doppler Effect.pdf
Working Principle of Echo Sounder and Doppler Effect.pdfWorking Principle of Echo Sounder and Doppler Effect.pdf
Working Principle of Echo Sounder and Doppler Effect.pdf
 
UNIT 4 PTRP final Convergence in probability.pptx
UNIT 4 PTRP final Convergence in probability.pptxUNIT 4 PTRP final Convergence in probability.pptx
UNIT 4 PTRP final Convergence in probability.pptx
 
UNIT-2 image enhancement.pdf Image Processing Unit 2 AKTU
UNIT-2 image enhancement.pdf Image Processing Unit 2 AKTUUNIT-2 image enhancement.pdf Image Processing Unit 2 AKTU
UNIT-2 image enhancement.pdf Image Processing Unit 2 AKTU
 
8th International Conference on Soft Computing, Mathematics and Control (SMC ...
8th International Conference on Soft Computing, Mathematics and Control (SMC ...8th International Conference on Soft Computing, Mathematics and Control (SMC ...
8th International Conference on Soft Computing, Mathematics and Control (SMC ...
 
Tembisa Central Terminating Pills +27838792658 PHOMOLONG Top Abortion Pills F...
Tembisa Central Terminating Pills +27838792658 PHOMOLONG Top Abortion Pills F...Tembisa Central Terminating Pills +27838792658 PHOMOLONG Top Abortion Pills F...
Tembisa Central Terminating Pills +27838792658 PHOMOLONG Top Abortion Pills F...
 
Augmented Reality (AR) with Augin Software.pptx
Augmented Reality (AR) with Augin Software.pptxAugmented Reality (AR) with Augin Software.pptx
Augmented Reality (AR) with Augin Software.pptx
 
Insurance management system project report.pdf
Insurance management system project report.pdfInsurance management system project report.pdf
Insurance management system project report.pdf
 
What is Coordinate Measuring Machine? CMM Types, Features, Functions
What is Coordinate Measuring Machine? CMM Types, Features, FunctionsWhat is Coordinate Measuring Machine? CMM Types, Features, Functions
What is Coordinate Measuring Machine? CMM Types, Features, Functions
 
Filters for Electromagnetic Compatibility Applications
Filters for Electromagnetic Compatibility ApplicationsFilters for Electromagnetic Compatibility Applications
Filters for Electromagnetic Compatibility Applications
 

01-distributed-systems-primer.pdf

  • 1. Distributed Systems 1, Columbia Course 4113, Instructor: Roxana Geambasu Distributed Systems 1 CUCS Course 4113 https://systems.cs.columbia.edu/ds1-class/ Instructor: Roxana Geambasu 1
  • 2. Distributed Systems 1, Columbia Course 4113, Instructor: Roxana Geambasu Distributed Systems Primer 2
  • 3. Distributed Systems 1, Columbia Course 4113, Instructor: Roxana Geambasu Outline • Challenges, Goals, and Approaches for DS • Example: Web Service Architecture 3
  • 4. Distributed Systems 1, Columbia Course 4113, Instructor: Roxana Geambasu Outline • Challenges, Goals, and Approaches for DS • Example: Web Service Architecture 4
  • 5. Distributed Systems 1, Columbia Course 4113, Instructor: Roxana Geambasu Context • Distribution is hard, for many reasons. • Distributed Systems (DS) aim to provide the core mechanisms that address the challenges and hide them under abstractions. • Not all challenges can be hidden, so DS developers and users must understand the challenges and approaches to address them. • Next we’ll talk about some of the challenges, goals, and approaches in DS design. 5
  • 6. Distributed Systems 1, Columbia Course 4113, Instructor: Roxana Geambasu Challenge 1: Ever-Growing Load • Data is big. Users are many. Requests are even more. No single machine can handle the ever-growing load. • A primary goal of DSes is to enable “multiple independent machines interconnected through a network to coordinate to achieve a common, consistent service or function.” • But effective coordination at scale is hard! 6 net- work M1 M2 M5 M4 M3 Mn
  • 7. Distributed Systems 1, Columbia Course 4113, Instructor: Roxana Geambasu Goal 1: Scalability • The more resource you add, the more data you should be able to store/process, and the more users you should be able to serve. • But never hope for perfect scalability: add one machine, increase your capacity proportionally forever. – Most often, the scalability curve tapers off as various components of the system start to reach their capacities (maximum handled load/unit of time, e.g., max number of requests completed per second). – Components that limit scalability are called bottlenecks and sometimes they can be very hidden (logging server, network router). 7
  • 8. Distributed Systems 1, Columbia Course 4113, Instructor: Roxana Geambasu Sample Scalability Curves # machines Capacity (handled load/time) A 1 C B 8 POLL TIME!
  • 9. Distributed Systems 1, Columbia Course 4113, Instructor: Roxana Geambasu Approach 1: Sharding • Launch multiple processes (a.k.a., workers), split up your load into pieces (a.k.a., shards), and assign different shards to different workers. • The workers should be designed to coordinate to achieve a common, consistent service despite the sharding. • Unfortunately, sharding raises semantic challenges esp. with failures. 9
  • 10. Distributed Systems 1, Columbia Course 4113, Instructor: Roxana Geambasu Challenge 2: At Scale, Failures Are Inevitable 10 • Many types of failures: • network, machine (software, hardware, flipped bits in memory,..), datacenter,… • some are small and isolated, others are major failures • some are persistent, others are temporary • some resolve themselves, others require human intervention … • At scale, failures are almost guaranteed to occur all the time, and most of them occur at unpredictable times. • The big challenge is that failures greatly challenge coordination between the machines of a distributed systems.
  • 11. Distributed Systems 1, Columbia Course 4113, Instructor: Roxana Geambasu Goal 2: Fault Tolerance • Goal is to hide failures as much as possible to provide a service that e.g., finishes the computation fast despite failures, stores some data reliably despite failures, … • Fault tolerance subsumes: – Availability: the service/data continues to be operational despite failures. – Durability: some data or updates that have been acknowledged by the system will persist despite failures and will eventually become available. • Durability differs from availability: durability can be thought of as “eventual availability” of some data or state. 11
  • 12. Distributed Systems 1, Columbia Course 4113, Instructor: Roxana Geambasu Approach 2: Replication • Have multiple replicas execute/store the same shard; if one replica dies, another replica can provide the data/computation. • Example: – Say you’re computing a maximum over a sharded dataset across multiple workers. – Have the maximum over each shard be computed by 2-3 replicas in parallel. – If one replica dies, another one can report the max to the other n-1 worker sets. 12
  • 13. Distributed Systems 1, Columbia Course 4113, Instructor: Roxana Geambasu Challenge 3: Consistency in Sharded and Replicated Systems is HARD • Example: – Say we want to compute an exact average over a sharded and replicated dataset. – How do we make sure that we incorporate the average over each shard only once if the average over each shard is computed and reported by three replicas? – Assigning each shard a unique ID may help, but what if the faulty replica does not die, but instead spews up a faulty value due to, e.g., memory error. 13
  • 14. Distributed Systems 1, Columbia Course 4113, Instructor: Roxana Geambasu Goal 3: Meaningful Consistency Semantics • Dealing with these issues is hard for both the programmers and users. • The goal is to build infrastructure systems (such as storage systems, computation frameworks, etc.) that provide clear semantics that hold in the face of failures, and to express those semantics clearly in APIs. • Example: – Say you decide that in case of failure your distributed computation system will return the results of a partial computation. – Then you need to communicate that through your API. You should also provide error bounds for the results you are reporting. That’s semantic. .14
  • 15. Distributed Systems 1, Columbia Course 4113, Instructor: Roxana Geambasu Approach 3: Rigorous Protocols • The general approach is to develop rigorous protocols, which we will generically call agreement protocols, that allow workers and replicas to coordinate in a consistent way despite failures. • Agreement protocols often rely on the notion of majorities: as long as a majority agrees on a value, the idea is that it can be safe to continue making that action. • Different protocols exist for different consistency challenges, and often the protocols can be composed to address bigger, more realistic challenges. 15
  • 16. Distributed Systems 1, Columbia Course 4113, Instructor: Roxana Geambasu Outline • Challenges, Goals, and Approaches for DS • Example: Web Service Architecture 16
  • 17. Distributed Systems 1, Columbia Course 4113, Instructor: Roxana Geambasu Basic Architecture Web front end (FE), database server (DB), network. FE is stateless, all state in DB. Properties: • Scalability? • Fault tolerance? • Semantics? • Performance? 17
  • 18. Distributed Systems 1, Columbia Course 4113, Instructor: Roxana Geambasu Basic Architecture 18 • Performance: poor. • Fault tolerance: poor. • Scalability: poor. • Semantics (consistency): great!
  • 19. Distributed Systems 1, Columbia Course 4113, Instructor: Roxana Geambasu Basic Architecture 19 • Performance: poor. • Fault tolerance: poor. • Scalability: poor. • Semantics (consistency): great! First, let’s improve performance (latency).
  • 20. Distributed Systems 1, Columbia Course 4113, Instructor: Roxana Geambasu Goal: Reduce Latency Web FE’s reads/writes go through in-memory cache ($$). • Performance? – For reads? – For writes? • Fault tolerance? – Availability? – Durability? • Scalability? • Semantics/consistency? 20
  • 21. Distributed Systems 1, Columbia Course 4113, Instructor: Roxana Geambasu Goal: Reduce Latency • Read latency: improved if working set fits in memory. • Durability: depends on cache: good for write-through $$, poor for write-back $$. • Write latency is opposite: good with write-back, poor with write-through. • Consistency: good: you have 1 FE accesses DB, going through 1 $$, so behavior is equivalent to single machine. 21
  • 22. Distributed Systems 1, Columbia Course 4113, Instructor: Roxana Geambasu Goal: Reduce Latency Let’s deal with scalability, first on FE and later on DB. 22 • Read latency: improved if working set fits in memory. • Durability: depends on cache: good for write-through $$, poor for write-back $$. • Write latency is opposite: good with write-back, poor with write-through. • Consistency: good: you have 1 FE accesses DB, going through 1 $$, so behavior is equivalent to single machine.
  • 23. Distributed Systems 1, Columbia Course 4113, Instructor: Roxana Geambasu Goal: Scale Out the FE (and get fault tolerance for it) Launch multiple FEs. Each has its own local cache, which we’ll assume is write-through. • Performance? • Fault tolerance? • Scalability? • Semantics (consistency)? 23
  • 24. Distributed Systems 1, Columbia Course 4113, Instructor: Roxana Geambasu Goal: Fault Tolerance for DB • Launch identical replicas of the DB server, each with its disk. All replicas hold all data, writes go to all. • Performance? • Fault tolerance? • Scalability? • Semantics (consistency)? 24 BREAKOUT
  • 25. Distributed Systems 1, Columbia Course 4113, Instructor: Roxana Geambasu Goal: Fault Tolerance for DB • Writes now need to propagate to all replicas. So they are much slower! Even if done in parallel, because FE now needs to wait for the slowest of DB replicas to commit (assuming write-through cache, which offers the best durability). • All replicas must see all writes IN THE SAME ORDER! If order is exchanged, they can quickly go “out of sync”! So lots more consistency issues. 25
  • 26. Distributed Systems 1, Columbia Course 4113, Instructor: Roxana Geambasu Goal: Fault Tolerance for DB • There are also availability issues. If you require all the replicas to be available when a write is satisfied (for durability), availability goes DOWN! Consensus protocols, which work on a majority of replicas, address this. • Another consistency challenge: how are reads handled? If you read from one replica, which one should you read given that updates to the item you’re interested in might be in flight as you attempt to read it? We’ll address these issues in future lectures by structuring the replica set. 26
  • 27. Distributed Systems 1, Columbia Course 4113, Instructor: Roxana Geambasu Goal: Fault Tolerance for DB • There are also availability issues. If you require all the replicas to be available when a write is satisfied (for durability), availability goes DOWN! Consensus protocols, which work on a majority of replicas, address this. • Another consistency challenge: how are reads handled? If you read from one replica, which one should you read given that updates to the item you’re interested in might be in flight as you attempt to read it? We’ll address these issues in future lectures by structuring the replica set. 27 Let’s deal with DB scalability.
  • 28. Distributed Systems 1, Columbia Course 4113, Instructor: Roxana Geambasu Last Goal: Scale Out the DB Partition the database into multiple shards, replicate each multiple times for fault tolerance. Requests for different shards go to different replica groups. • Performance? • Fault tolerance? • Scalability? • Semantics (consistency)? 28
  • 29. Distributed Systems 1, Columbia Course 4113, Instructor: Roxana Geambasu New challenges that arise: • How should data be sharded? Based on users, on some property of the data? • How should different partitions get assigned to replica groups? How do clients know which servers serve/store which shards? • If the FE wants to write/read multiple entries in the DB, how can it do that atomically if they span multiple shards? If different replica groups need to coordinate to implement atomic updates across shards, won’t that hinder scalability? 29 Final Goal: Scale Out the DB
  • 30. Distributed Systems 1, Columbia Course 4113, Instructor: Roxana Geambasu Take-Aways • Scalability, fault tolerance, consistency, and performance are difficult goals to achieve together. • Solving them requires rigorous protocols and system architectures. • This class teaches such protocols and architectures, plus how they are incorporated in real systems. 30