SlideShare a Scribd company logo
1 of 45
Distributed Systems
and
Scalability Rules
Oleg Tsal-Tsalko
Email: oleg.tsalko@gmail.com
Skype: oleg.tsalko
Twitter: @tsaltsol
What is distributed system?
A distributed system is a collection of independent
computers that coordinate their activity and share
resources and appears to its users as a single coherent
system.
Why do we need distributed
systems?
• Nature of application required distributed
network/system
• Availability/Reliability (no single point of failure)
• Performance (bunch of commodity servers give
more performance that one supercomputer)
• Cost efficient (bunch of commodity servers cost less
than one supercomputer)
Examples
•
•
•
•
•
•
•
•

Telecom networks (telephone/computer networks)
WWW, peer-to-peer networks
Multiplayer online games
Distributed databases
Network file systems
Aircraft control systems
Scientific computing (cluster/grid computing)
Distributed rendering
Distributed systems characteristics
Lack of a global clock
Multiple autonomous components
Components are not shared by all users
Resources may not be accessible
Software runs in concurrent processes on different processors
Multiple Points of control (distributed management)
Multiple Points of failure (fault tolerance)
The structure of the system (network topology, network
latency, number of computers) is not known in advance
• Each computer has only a limited, incomplete view of the system.
•
•
•
•
•
•
•
•
Advantages over centralized
systems
Scalability
Redundancy

•The system can easily be expanded by adding more machines as needed.

•Several machines can provide the same services, so if one is unavailable, work does not stop.

Economics

•A collection of microprocessors offer a better price/performance than mainframes. Low
price/performance ratio: cost effective way to increase computing power.

Reliability

•If one machine crashes, the system as a whole can still survive.

Speed
Incremental growth

•A distributed system may have more total computing power than a mainframe

•Computing power can be added in small increments
Advantages over independent PCs
Data sharing

• Allow many users to access common data

Resource sharing

• Allow shared access to common resources

Communication

• Enhance human-to-human communication

Flexibility

• Spread the workload over the available machines
Parallel computing

Distributed computing

•In parallel
computing, all
processors may have
access to a shared
memory to exchange
information between
processors.

•In distributed
computing, each
processor has its own
private memory
(distributed memory).
Information is
exchanged by passing
messages between the
processors.
Algorithms
Parallel algorithms in shared-memory model
• All computers have access to a shared memory. The algorithm designer chooses the
program executed by each computer.

Parallel algorithms in message-passing model
• The algorithm designer chooses the structure of the network, as well as the program
executed by each computer.

Distributed algorithms in message-passing model
• The algorithm designer only chooses the computer program. All computers run the
same program. The system must work correctly regardless of the structure of the
network.
It appeared that Distributed
Systems have some fundamental
problems!
Byzantine fault-tolerance problem
The objective of Byzantine fault tolerance is to be able
to defend against Byzantine failures, in which
components of a system fail in arbitrary ways

Known algorithms can ensure correct operation only if
<1/3 of the processes are faulty.
Byzantine Generals
and
Two Generals problems

It is proved that there is no solution for these problems other than probabilistic…
Consensus problem
• Agreeing on the identity of leader
• State-machine replication
• Atomic broadcasts
There are number of protocols to solve consensus problem in distributed
systems such as widely used `Paxos consensus protocol` http://en.wikipedia.org/wiki/Paxos_algorithm
Types of distributed systems

Cluster
computing
systems

Grid
computing
systems
Grid computing
Grid computing is the collection of computer
resources from multiple locations to reach a common
goal. What distinguishes grid computing from
conventional high performance computing systems
such as cluster computing is that grids tend to be more
loosely coupled, heterogeneous, and geographically
dispersed.
Cluster computing
Computer clustering relies on a centralized
management approach which makes the nodes
available as orchestrated shared servers. It is distinct
from other approaches such as peer to peer or grid
computing which also use many nodes, but with a far
more distributed nature.
Distributed systems design and
architecture principles
The art of
simplicity

Scaling out
(X/Y/Z-axis)

Aggressive use of
caching

Using messaging
whenever
possible

Redundancy to
achieve HA

Replication

Sharding

Scaling your
database level

Data locality

Consistency

Fault tolerance

CAP theorem
Architecture principles

® Copyright 2012 Gigaspaces Ltd. All Rights
Reserved

18
HA nodes configuration
Active/active (Load
balanced)

• Traffic intended for the failed node is either passed onto an
existing node or load balanced across the remaining nodes.

Active/passive

• Provides a fully redundant instance of each node, which is
only brought online when its associated primary node fails:

Hot standby
Warm standby

Cold standby

• Software components are installed and available on both
primary and secondary nodes.

• The software component is installed and available on
the secondary node. The secondary node is up and
running.
• The secondary node acts as backup of another identical
primary system. It will be installed and configured only
when the primary node breaks down for the first time.
Redundancy as is
•
•
•
•
•
•

Redundant Web/App Servers
Redundant databases
Disk mirroring
Redundant network
Redundant storage network
Redundant electrical power
Redundancy in HA cluster
• Easy start/stop procedures
• Using NAS/SAN shared storage
• App should be able to store it’s state in shared
storage

• App should be able to restart from stored
shared state on another node

• App shouldn’t corrupt data if it crashes or
restarted
Replication
Replication in computing involves sharing information so as to
ensure consistency between redundant resources.
• Primary-backup (master-slave) schema – only primary node
processing requests.
• Multi-primary (multi-master) schema – all nodes are
processing requests simultaneously and distribute state
between each other.
Backup differs from replication in that it saves a copy of data
unchanged for a long period of time. Replicas, on the other
hand, undergo frequent updates and quickly lose any
historical state.
Replication models
• Transactional replication. Synchronous replication to number of nodes.
• State machine replication. Using state machine based on Paxis
algorithm.
• Virtual synchrony (Performance over fault-tolerance). Sending
asynchronous events to other nodes.

• Synchronous replication (Consistency over Performance) - guarantees
"zero data loss" by the means of atomic write operation.
• Asynchronous replication (Performance over Consistency) (Eventual
consistency) - write is considered complete as soon as local storage
acknowledges it. Remote storage is updated, but probably with a
small lag.
Sharding (Partitioning)
Sharding is the process of storing data records across multiple
machines to meet demands of data growth.
Why sharding?
• High query rates can exhaust the CPU capacity of the
server.
• Larger data sets exceed the storage capacity of a single
machine.
• Finally, working set sizes larger than the system’s RAM stress
the I/O capacity of disk drives.
Sharding (Partitioning)
• Sharding reduces the number
of operations each shard
handles.
• Sharding reduces the amount
of data that each server needs
to store.
Data Partitioning Principles
Partitioned Data
Feeder

Virtual Machine

Virtual Machine

Virtual Machine

Back to key
scenarios

Partitioned Data with Backup Per Partition
Feeder
Replication

Replication

Backup 1

Primary 1

Primary 2

Backup 2

Virtual Machine

Virtual Machine

Virtual Machine

Virtual Machine

® Copyright 2012 Gigaspaces Ltd. All Rights Reserved

26
Split-brain problem
When connectivity between nodes in cluster gone
and cluster divided in several parts

Solutions:
• Optimistic approach (Availability over Consistency)
o Leave as is and rely on later resynch (Hazelcast)

• Pessimistic approach (Consistency over Availability)
o Leave only one partition live before connectivity fixed (MongoDB)
Consistency

Strong
Weak

Eventual

• After update completes any subsequent access will
return the updated value.

• The system does not guarantee that subsequent
accesses will return the updated value.

• The storage system guarantees that if no new updates
are made to object eventually all accesses will return
the last updated value.
Eventually consistent
Strong => W + R > N
Weak/Eventual => W + R <= N
Optimized read => R=1, W=N
Optimized write => W=1, R=N
N – number of nodes
W – number of replicas to aknowledge update
R – number of replicas contacted for read
Fault tolerance
(Architecture concepts)

Fault tolerant
system:

Approaches:

• No single point of failure
• Fault isolation
• Roll-back/Roll-forward procedures

• Replication
• Redundancy
• Diversity – several alternative implementations of
some functionality
Fault tolerance
(Design principles)

Design using fault isolated “swimlanes”
Never trust single point of failure
Avoid putting systems in series
Ensure you have “switch on/switch off” for your new functionality
Data locality

Put data closer to clients scaling by Z-axis.
Locate processing units near data to be processed.
BASE
• Basic Availability
• Soft-state
• Eventual consistency

Alternative model to well known ACID which is used in
Distributed Systems to relax strong consistency
constraints in favor to achieve higher Availability
together with Partition Tolerance as per CAP theorem.
CAP theorem
CAP prove
Eric Brewer’s quote
“Because partitions are rare, CAP should allow perfect C and A most of
the time, but when partitions are present or perceived, a strategy that
detects partitions and explicitly accounts for them is in order. This
strategy should have three steps: detect partitions, enter an explicit
partition mode that can limit some operations, and initiate a recovery
process to restore consistency and compensate for mistakes made
during a partition.”
Eric Brewer’s recipe
Design principles

® Copyright 2012 Gigaspaces Ltd. All Rights
Reserved

38
Scaling out (Z/Y/Z axis)
[X-Axis]: Horizontal duplication (design to clone things)
[Y-Axis]: Split by Function, Service or Resource (design to split diff things)
[Z-Axis]: Lookups split (design to split similar things)
The art of simplicity
KISS (Keep it simple). Don’t overengineer a solution.
Simplify solution 3 times over (scope, design, implementation)
Reduce DNS lookups. Reduce objects where possible (Google main page)

Use homogenous networks where possible
Avoid too many traffic redirects
Don’t check your work (avoid defensive programing)
Relax temporal constraints where possible
Aggressive use of caching
Use expires headers
Cache AJAX calls
Leverage Page Caches (Proxy Web Servers)
Utilize Application caches
Use Object Caches (ORM level)

Put caches in their own tier
Caching on different levels
Using messaging whenever
possible
• Communicate asynchronously as
much as possible
• Ensure your message bus can scale
• Avoid overcrowding your message
bus
Scaling your database layer
Denormalize data where possible cause relationships are costly.

Use the right type of lock.
Avoid using multiphase commits and distributed transactions.
Avoid using “select for update” statements.
Don’t select everything.
Thank you
and
questions!
Oleg Tsal-Tsalko
Email: oleg.tsalko@gmail.com
Skype: oleg.tsalko
Twitter: @tsaltsol

® Copyright 2012 Gigaspaces Ltd. All Rights
Reserved

45

More Related Content

What's hot

Database , 12 Reliability
Database , 12 ReliabilityDatabase , 12 Reliability
Database , 12 ReliabilityAli Usman
 
Chapter 8 - Multimedia Storage and Retrieval
Chapter 8 - Multimedia Storage and RetrievalChapter 8 - Multimedia Storage and Retrieval
Chapter 8 - Multimedia Storage and RetrievalPratik Pradhan
 
System models in distributed system
System models in distributed systemSystem models in distributed system
System models in distributed systemishapadhy
 
Processor allocation in Distributed Systems
Processor allocation in Distributed SystemsProcessor allocation in Distributed Systems
Processor allocation in Distributed SystemsRitu Ranjan Shrivastwa
 
High Performance Computing Presentation
High Performance Computing PresentationHigh Performance Computing Presentation
High Performance Computing Presentationomar altayyan
 
Distributed design alternatives
Distributed design alternativesDistributed design alternatives
Distributed design alternativesPooja Dixit
 
Activation function
Activation functionActivation function
Activation functionAstha Jain
 
Digital Image Processing
Digital Image ProcessingDigital Image Processing
Digital Image ProcessingSahil Biswas
 
Clustering: Large Databases in data mining
Clustering: Large Databases in data miningClustering: Large Databases in data mining
Clustering: Large Databases in data miningZHAO Sam
 
Logics for non monotonic reasoning-ai
Logics for non monotonic reasoning-aiLogics for non monotonic reasoning-ai
Logics for non monotonic reasoning-aiShaishavShah8
 
Clock Synchronization in Distributed Systems
Clock Synchronization in Distributed SystemsClock Synchronization in Distributed Systems
Clock Synchronization in Distributed SystemsZbigniew Jerzak
 
Synchronization in distributed systems
Synchronization in distributed systems Synchronization in distributed systems
Synchronization in distributed systems SHATHAN
 
Distributed Systems
Distributed SystemsDistributed Systems
Distributed SystemsRupsee
 
Types of Load distributing algorithm in Distributed System
Types of Load distributing algorithm in Distributed SystemTypes of Load distributing algorithm in Distributed System
Types of Load distributing algorithm in Distributed SystemDHIVYADEVAKI
 

What's hot (20)

Parallel processing
Parallel processingParallel processing
Parallel processing
 
Database , 12 Reliability
Database , 12 ReliabilityDatabase , 12 Reliability
Database , 12 Reliability
 
11. dfs
11. dfs11. dfs
11. dfs
 
Chapter 8 - Multimedia Storage and Retrieval
Chapter 8 - Multimedia Storage and RetrievalChapter 8 - Multimedia Storage and Retrieval
Chapter 8 - Multimedia Storage and Retrieval
 
System models in distributed system
System models in distributed systemSystem models in distributed system
System models in distributed system
 
Processor allocation in Distributed Systems
Processor allocation in Distributed SystemsProcessor allocation in Distributed Systems
Processor allocation in Distributed Systems
 
Process Management-Process Migration
Process Management-Process MigrationProcess Management-Process Migration
Process Management-Process Migration
 
High Performance Computing Presentation
High Performance Computing PresentationHigh Performance Computing Presentation
High Performance Computing Presentation
 
Distributed Transaction
Distributed TransactionDistributed Transaction
Distributed Transaction
 
Distributed design alternatives
Distributed design alternativesDistributed design alternatives
Distributed design alternatives
 
High–Performance Computing
High–Performance ComputingHigh–Performance Computing
High–Performance Computing
 
Activation function
Activation functionActivation function
Activation function
 
Digital Image Processing
Digital Image ProcessingDigital Image Processing
Digital Image Processing
 
Clustering: Large Databases in data mining
Clustering: Large Databases in data miningClustering: Large Databases in data mining
Clustering: Large Databases in data mining
 
Logics for non monotonic reasoning-ai
Logics for non monotonic reasoning-aiLogics for non monotonic reasoning-ai
Logics for non monotonic reasoning-ai
 
Clock Synchronization in Distributed Systems
Clock Synchronization in Distributed SystemsClock Synchronization in Distributed Systems
Clock Synchronization in Distributed Systems
 
Synchronization in distributed systems
Synchronization in distributed systems Synchronization in distributed systems
Synchronization in distributed systems
 
Distributed Systems
Distributed SystemsDistributed Systems
Distributed Systems
 
Types of Load distributing algorithm in Distributed System
Types of Load distributing algorithm in Distributed SystemTypes of Load distributing algorithm in Distributed System
Types of Load distributing algorithm in Distributed System
 
Message passing in Distributed Computing Systems
Message passing in Distributed Computing SystemsMessage passing in Distributed Computing Systems
Message passing in Distributed Computing Systems
 

Viewers also liked

Distributed Systems: scalability and high availability
Distributed Systems: scalability and high availabilityDistributed Systems: scalability and high availability
Distributed Systems: scalability and high availabilityRenato Lucindo
 
Icmens 2009 L100
Icmens 2009   L100Icmens 2009   L100
Icmens 2009 L100khalid_nitt
 
Daad March 8th 2010
Daad   March 8th 2010Daad   March 8th 2010
Daad March 8th 2010khalid_nitt
 
A Compositional Encoding for the Asynchronous Pi-Calculus into the Join-Calculus
A Compositional Encoding for the Asynchronous Pi-Calculus into the Join-CalculusA Compositional Encoding for the Asynchronous Pi-Calculus into the Join-Calculus
A Compositional Encoding for the Asynchronous Pi-Calculus into the Join-Calculussmennicke
 
FSLN12 Kick-Off, TU Braunschweig
FSLN12 Kick-Off, TU BraunschweigFSLN12 Kick-Off, TU Braunschweig
FSLN12 Kick-Off, TU Braunschweigalexanderperl
 
Digests for the book "Scalability Rules: 50 Principles for Scaling Web Sites"
Digests for the book "Scalability Rules: 50 Principles for Scaling Web Sites"Digests for the book "Scalability Rules: 50 Principles for Scaling Web Sites"
Digests for the book "Scalability Rules: 50 Principles for Scaling Web Sites"Cyril Wang
 
State Machine Design and Synthesis
State Machine Design and SynthesisState Machine Design and Synthesis
State Machine Design and SynthesisAbhilash Nair
 
Practical Byzantine Fault Tolerance
Practical Byzantine Fault TolerancePractical Byzantine Fault Tolerance
Practical Byzantine Fault ToleranceSuman Karumuri
 
Distributed Consensus: Making the Impossible Possible
Distributed Consensus: Making the Impossible PossibleDistributed Consensus: Making the Impossible Possible
Distributed Consensus: Making the Impossible PossibleC4Media
 
Building Scalable Organizations
Building Scalable OrganizationsBuilding Scalable Organizations
Building Scalable Organizationsmfisher5kavika
 
Block Chains and Consensus Algos
Block Chains and Consensus AlgosBlock Chains and Consensus Algos
Block Chains and Consensus AlgosJerry David Chan
 
Distributed Systems Theory for Mere Mortals
Distributed Systems Theory for Mere MortalsDistributed Systems Theory for Mere Mortals
Distributed Systems Theory for Mere MortalsEnsar Basri Kahveci
 
From Mainframe to Microservice: An Introduction to Distributed Systems
From Mainframe to Microservice: An Introduction to Distributed SystemsFrom Mainframe to Microservice: An Introduction to Distributed Systems
From Mainframe to Microservice: An Introduction to Distributed SystemsTyler Treat
 
RESIGN REPUBLIC: An education technology platform by Ali. R. Khan
RESIGN REPUBLIC: An education technology platform by Ali. R. KhanRESIGN REPUBLIC: An education technology platform by Ali. R. Khan
RESIGN REPUBLIC: An education technology platform by Ali. R. KhanAli Rahman Khan
 
Replication and Synchronization Algorithms for Distributed Databases - Lena W...
Replication and Synchronization Algorithms for Distributed Databases - Lena W...Replication and Synchronization Algorithms for Distributed Databases - Lena W...
Replication and Synchronization Algorithms for Distributed Databases - Lena W...distributed matters
 
The State of HBase Replication
The State of HBase ReplicationThe State of HBase Replication
The State of HBase ReplicationHBaseCon
 
Distributed algorithms for big data @ GeeCon
Distributed algorithms for big data @ GeeConDistributed algorithms for big data @ GeeCon
Distributed algorithms for big data @ GeeConDuyhai Doan
 

Viewers also liked (20)

Scalability Design Principles - Internal Session
Scalability Design Principles - Internal SessionScalability Design Principles - Internal Session
Scalability Design Principles - Internal Session
 
Distributed Systems: scalability and high availability
Distributed Systems: scalability and high availabilityDistributed Systems: scalability and high availability
Distributed Systems: scalability and high availability
 
Icmens 2009 L100
Icmens 2009   L100Icmens 2009   L100
Icmens 2009 L100
 
Daad March 8th 2010
Daad   March 8th 2010Daad   March 8th 2010
Daad March 8th 2010
 
A Compositional Encoding for the Asynchronous Pi-Calculus into the Join-Calculus
A Compositional Encoding for the Asynchronous Pi-Calculus into the Join-CalculusA Compositional Encoding for the Asynchronous Pi-Calculus into the Join-Calculus
A Compositional Encoding for the Asynchronous Pi-Calculus into the Join-Calculus
 
FSLN12 Kick-Off, TU Braunschweig
FSLN12 Kick-Off, TU BraunschweigFSLN12 Kick-Off, TU Braunschweig
FSLN12 Kick-Off, TU Braunschweig
 
Digests for the book "Scalability Rules: 50 Principles for Scaling Web Sites"
Digests for the book "Scalability Rules: 50 Principles for Scaling Web Sites"Digests for the book "Scalability Rules: 50 Principles for Scaling Web Sites"
Digests for the book "Scalability Rules: 50 Principles for Scaling Web Sites"
 
Blockchain Hub Seminar
Blockchain Hub SeminarBlockchain Hub Seminar
Blockchain Hub Seminar
 
State Machine Design and Synthesis
State Machine Design and SynthesisState Machine Design and Synthesis
State Machine Design and Synthesis
 
Practical Byzantine Fault Tolerance
Practical Byzantine Fault TolerancePractical Byzantine Fault Tolerance
Practical Byzantine Fault Tolerance
 
Distributed Consensus: Making the Impossible Possible
Distributed Consensus: Making the Impossible PossibleDistributed Consensus: Making the Impossible Possible
Distributed Consensus: Making the Impossible Possible
 
Building Scalable Organizations
Building Scalable OrganizationsBuilding Scalable Organizations
Building Scalable Organizations
 
Block Chains and Consensus Algos
Block Chains and Consensus AlgosBlock Chains and Consensus Algos
Block Chains and Consensus Algos
 
Distributed Systems Theory for Mere Mortals
Distributed Systems Theory for Mere MortalsDistributed Systems Theory for Mere Mortals
Distributed Systems Theory for Mere Mortals
 
PBFT
PBFTPBFT
PBFT
 
From Mainframe to Microservice: An Introduction to Distributed Systems
From Mainframe to Microservice: An Introduction to Distributed SystemsFrom Mainframe to Microservice: An Introduction to Distributed Systems
From Mainframe to Microservice: An Introduction to Distributed Systems
 
RESIGN REPUBLIC: An education technology platform by Ali. R. Khan
RESIGN REPUBLIC: An education technology platform by Ali. R. KhanRESIGN REPUBLIC: An education technology platform by Ali. R. Khan
RESIGN REPUBLIC: An education technology platform by Ali. R. Khan
 
Replication and Synchronization Algorithms for Distributed Databases - Lena W...
Replication and Synchronization Algorithms for Distributed Databases - Lena W...Replication and Synchronization Algorithms for Distributed Databases - Lena W...
Replication and Synchronization Algorithms for Distributed Databases - Lena W...
 
The State of HBase Replication
The State of HBase ReplicationThe State of HBase Replication
The State of HBase Replication
 
Distributed algorithms for big data @ GeeCon
Distributed algorithms for big data @ GeeConDistributed algorithms for big data @ GeeCon
Distributed algorithms for big data @ GeeCon
 

Similar to Distributed systems and scalability rules

Overview of Distributed Systems
Overview of Distributed SystemsOverview of Distributed Systems
Overview of Distributed Systemsvampugani
 
Chapter Introductionn to distributed system .pptx
Chapter Introductionn to distributed system .pptxChapter Introductionn to distributed system .pptx
Chapter Introductionn to distributed system .pptxTekle12
 
Cluster computing ppt
Cluster computing pptCluster computing ppt
Cluster computing pptDC Graphics
 
Intro to distributed systems
Intro to distributed systemsIntro to distributed systems
Intro to distributed systemsAhmed Soliman
 
Apos week 1 4
Apos week 1   4Apos week 1   4
Apos week 1 4alixafar
 
CS8603_Notes_003-1_edubuzz360.pdf
CS8603_Notes_003-1_edubuzz360.pdfCS8603_Notes_003-1_edubuzz360.pdf
CS8603_Notes_003-1_edubuzz360.pdfKishaKiddo
 
An operating system for multicore and clouds: mechanism and implementation
An operating system for multicore and clouds: mechanism and implementationAn operating system for multicore and clouds: mechanism and implementation
An operating system for multicore and clouds: mechanism and implementationMohanadarshan Vivekanandalingam
 
introduction to cloud computing for college.pdf
introduction to cloud computing for college.pdfintroduction to cloud computing for college.pdf
introduction to cloud computing for college.pdfsnehan789
 
Introduction to Parallel Computing
Introduction to Parallel ComputingIntroduction to Parallel Computing
Introduction to Parallel ComputingAkhila Prabhakaran
 
EMBEDDED OS
EMBEDDED OSEMBEDDED OS
EMBEDDED OSAJAL A J
 
Cluster computing
Cluster computingCluster computing
Cluster computingMegha yadav
 

Similar to Distributed systems and scalability rules (20)

Overview of Distributed Systems
Overview of Distributed SystemsOverview of Distributed Systems
Overview of Distributed Systems
 
Clusters
ClustersClusters
Clusters
 
Chapter Introductionn to distributed system .pptx
Chapter Introductionn to distributed system .pptxChapter Introductionn to distributed system .pptx
Chapter Introductionn to distributed system .pptx
 
CLUSTER COMPUTING
CLUSTER COMPUTINGCLUSTER COMPUTING
CLUSTER COMPUTING
 
Introduction
IntroductionIntroduction
Introduction
 
Cluster
ClusterCluster
Cluster
 
CCUnit1.pdf
CCUnit1.pdfCCUnit1.pdf
CCUnit1.pdf
 
Cluster computing ppt
Cluster computing pptCluster computing ppt
Cluster computing ppt
 
Cluster computing
Cluster computingCluster computing
Cluster computing
 
Intro to distributed systems
Intro to distributed systemsIntro to distributed systems
Intro to distributed systems
 
Apos week 1 4
Apos week 1   4Apos week 1   4
Apos week 1 4
 
CS8603_Notes_003-1_edubuzz360.pdf
CS8603_Notes_003-1_edubuzz360.pdfCS8603_Notes_003-1_edubuzz360.pdf
CS8603_Notes_003-1_edubuzz360.pdf
 
An operating system for multicore and clouds: mechanism and implementation
An operating system for multicore and clouds: mechanism and implementationAn operating system for multicore and clouds: mechanism and implementation
An operating system for multicore and clouds: mechanism and implementation
 
chap-0 .ppt
chap-0 .pptchap-0 .ppt
chap-0 .ppt
 
introduction to cloud computing for college.pdf
introduction to cloud computing for college.pdfintroduction to cloud computing for college.pdf
introduction to cloud computing for college.pdf
 
Introduction to Parallel Computing
Introduction to Parallel ComputingIntroduction to Parallel Computing
Introduction to Parallel Computing
 
EMBEDDED OS
EMBEDDED OSEMBEDDED OS
EMBEDDED OS
 
Cluster Computing
Cluster ComputingCluster Computing
Cluster Computing
 
Cluster computing
Cluster computingCluster computing
Cluster computing
 
Distributed Systems.pptx
Distributed Systems.pptxDistributed Systems.pptx
Distributed Systems.pptx
 

More from Oleg Tsal-Tsalko

Developer on a mission (Devoxx UA 2021)
Developer on a mission (Devoxx UA 2021)Developer on a mission (Devoxx UA 2021)
Developer on a mission (Devoxx UA 2021)Oleg Tsal-Tsalko
 
From Streams to Reactive Streams
From Streams to Reactive StreamsFrom Streams to Reactive Streams
From Streams to Reactive StreamsOleg Tsal-Tsalko
 
JUG UA AdoptJSR participation
JUG UA AdoptJSR participationJUG UA AdoptJSR participation
JUG UA AdoptJSR participationOleg Tsal-Tsalko
 
Develop modern apps using Spring ecosystem at time of BigData
Develop modern apps using Spring ecosystem at time of BigData Develop modern apps using Spring ecosystem at time of BigData
Develop modern apps using Spring ecosystem at time of BigData Oleg Tsal-Tsalko
 
Java 8 date & time javaday2014
Java 8 date & time javaday2014Java 8 date & time javaday2014
Java 8 date & time javaday2014Oleg Tsal-Tsalko
 
Enterprise Integration Patterns
Enterprise Integration PatternsEnterprise Integration Patterns
Enterprise Integration PatternsOleg Tsal-Tsalko
 
JUG involvment in JCP and AdopJSR program
JUG involvment in JCP and AdopJSR programJUG involvment in JCP and AdopJSR program
JUG involvment in JCP and AdopJSR programOleg Tsal-Tsalko
 

More from Oleg Tsal-Tsalko (14)

Developer on a mission (Devoxx UA 2021)
Developer on a mission (Devoxx UA 2021)Developer on a mission (Devoxx UA 2021)
Developer on a mission (Devoxx UA 2021)
 
Developer on a mission
Developer on a missionDeveloper on a mission
Developer on a mission
 
From Streams to Reactive Streams
From Streams to Reactive StreamsFrom Streams to Reactive Streams
From Streams to Reactive Streams
 
Java 9 Jigsaw HackDay
Java 9 Jigsaw HackDayJava 9 Jigsaw HackDay
Java 9 Jigsaw HackDay
 
JUG UA AdoptJSR participation
JUG UA AdoptJSR participationJUG UA AdoptJSR participation
JUG UA AdoptJSR participation
 
Develop modern apps using Spring ecosystem at time of BigData
Develop modern apps using Spring ecosystem at time of BigData Develop modern apps using Spring ecosystem at time of BigData
Develop modern apps using Spring ecosystem at time of BigData
 
Java 8 features
Java 8 featuresJava 8 features
Java 8 features
 
Lambdas HOL
Lambdas HOLLambdas HOL
Lambdas HOL
 
Java 8 date & time javaday2014
Java 8 date & time javaday2014Java 8 date & time javaday2014
Java 8 date & time javaday2014
 
Java 8 date & time
Java 8 date & timeJava 8 date & time
Java 8 date & time
 
Get ready for spring 4
Get ready for spring 4Get ready for spring 4
Get ready for spring 4
 
Enterprise Integration Patterns
Enterprise Integration PatternsEnterprise Integration Patterns
Enterprise Integration Patterns
 
Next stop: Spring 4
Next stop: Spring 4Next stop: Spring 4
Next stop: Spring 4
 
JUG involvment in JCP and AdopJSR program
JUG involvment in JCP and AdopJSR programJUG involvment in JCP and AdopJSR program
JUG involvment in JCP and AdopJSR program
 

Recently uploaded

Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 

Recently uploaded (20)

Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 

Distributed systems and scalability rules

  • 1. Distributed Systems and Scalability Rules Oleg Tsal-Tsalko Email: oleg.tsalko@gmail.com Skype: oleg.tsalko Twitter: @tsaltsol
  • 2. What is distributed system? A distributed system is a collection of independent computers that coordinate their activity and share resources and appears to its users as a single coherent system.
  • 3. Why do we need distributed systems? • Nature of application required distributed network/system • Availability/Reliability (no single point of failure) • Performance (bunch of commodity servers give more performance that one supercomputer) • Cost efficient (bunch of commodity servers cost less than one supercomputer)
  • 4. Examples • • • • • • • • Telecom networks (telephone/computer networks) WWW, peer-to-peer networks Multiplayer online games Distributed databases Network file systems Aircraft control systems Scientific computing (cluster/grid computing) Distributed rendering
  • 5. Distributed systems characteristics Lack of a global clock Multiple autonomous components Components are not shared by all users Resources may not be accessible Software runs in concurrent processes on different processors Multiple Points of control (distributed management) Multiple Points of failure (fault tolerance) The structure of the system (network topology, network latency, number of computers) is not known in advance • Each computer has only a limited, incomplete view of the system. • • • • • • • •
  • 6. Advantages over centralized systems Scalability Redundancy •The system can easily be expanded by adding more machines as needed. •Several machines can provide the same services, so if one is unavailable, work does not stop. Economics •A collection of microprocessors offer a better price/performance than mainframes. Low price/performance ratio: cost effective way to increase computing power. Reliability •If one machine crashes, the system as a whole can still survive. Speed Incremental growth •A distributed system may have more total computing power than a mainframe •Computing power can be added in small increments
  • 7. Advantages over independent PCs Data sharing • Allow many users to access common data Resource sharing • Allow shared access to common resources Communication • Enhance human-to-human communication Flexibility • Spread the workload over the available machines
  • 8. Parallel computing Distributed computing •In parallel computing, all processors may have access to a shared memory to exchange information between processors. •In distributed computing, each processor has its own private memory (distributed memory). Information is exchanged by passing messages between the processors.
  • 9. Algorithms Parallel algorithms in shared-memory model • All computers have access to a shared memory. The algorithm designer chooses the program executed by each computer. Parallel algorithms in message-passing model • The algorithm designer chooses the structure of the network, as well as the program executed by each computer. Distributed algorithms in message-passing model • The algorithm designer only chooses the computer program. All computers run the same program. The system must work correctly regardless of the structure of the network.
  • 10. It appeared that Distributed Systems have some fundamental problems!
  • 11. Byzantine fault-tolerance problem The objective of Byzantine fault tolerance is to be able to defend against Byzantine failures, in which components of a system fail in arbitrary ways Known algorithms can ensure correct operation only if <1/3 of the processes are faulty.
  • 12. Byzantine Generals and Two Generals problems It is proved that there is no solution for these problems other than probabilistic…
  • 13. Consensus problem • Agreeing on the identity of leader • State-machine replication • Atomic broadcasts There are number of protocols to solve consensus problem in distributed systems such as widely used `Paxos consensus protocol` http://en.wikipedia.org/wiki/Paxos_algorithm
  • 14. Types of distributed systems Cluster computing systems Grid computing systems
  • 15. Grid computing Grid computing is the collection of computer resources from multiple locations to reach a common goal. What distinguishes grid computing from conventional high performance computing systems such as cluster computing is that grids tend to be more loosely coupled, heterogeneous, and geographically dispersed.
  • 16. Cluster computing Computer clustering relies on a centralized management approach which makes the nodes available as orchestrated shared servers. It is distinct from other approaches such as peer to peer or grid computing which also use many nodes, but with a far more distributed nature.
  • 17. Distributed systems design and architecture principles The art of simplicity Scaling out (X/Y/Z-axis) Aggressive use of caching Using messaging whenever possible Redundancy to achieve HA Replication Sharding Scaling your database level Data locality Consistency Fault tolerance CAP theorem
  • 18. Architecture principles ® Copyright 2012 Gigaspaces Ltd. All Rights Reserved 18
  • 19. HA nodes configuration Active/active (Load balanced) • Traffic intended for the failed node is either passed onto an existing node or load balanced across the remaining nodes. Active/passive • Provides a fully redundant instance of each node, which is only brought online when its associated primary node fails: Hot standby Warm standby Cold standby • Software components are installed and available on both primary and secondary nodes. • The software component is installed and available on the secondary node. The secondary node is up and running. • The secondary node acts as backup of another identical primary system. It will be installed and configured only when the primary node breaks down for the first time.
  • 20. Redundancy as is • • • • • • Redundant Web/App Servers Redundant databases Disk mirroring Redundant network Redundant storage network Redundant electrical power
  • 21. Redundancy in HA cluster • Easy start/stop procedures • Using NAS/SAN shared storage • App should be able to store it’s state in shared storage • App should be able to restart from stored shared state on another node • App shouldn’t corrupt data if it crashes or restarted
  • 22. Replication Replication in computing involves sharing information so as to ensure consistency between redundant resources. • Primary-backup (master-slave) schema – only primary node processing requests. • Multi-primary (multi-master) schema – all nodes are processing requests simultaneously and distribute state between each other. Backup differs from replication in that it saves a copy of data unchanged for a long period of time. Replicas, on the other hand, undergo frequent updates and quickly lose any historical state.
  • 23. Replication models • Transactional replication. Synchronous replication to number of nodes. • State machine replication. Using state machine based on Paxis algorithm. • Virtual synchrony (Performance over fault-tolerance). Sending asynchronous events to other nodes. • Synchronous replication (Consistency over Performance) - guarantees "zero data loss" by the means of atomic write operation. • Asynchronous replication (Performance over Consistency) (Eventual consistency) - write is considered complete as soon as local storage acknowledges it. Remote storage is updated, but probably with a small lag.
  • 24. Sharding (Partitioning) Sharding is the process of storing data records across multiple machines to meet demands of data growth. Why sharding? • High query rates can exhaust the CPU capacity of the server. • Larger data sets exceed the storage capacity of a single machine. • Finally, working set sizes larger than the system’s RAM stress the I/O capacity of disk drives.
  • 25. Sharding (Partitioning) • Sharding reduces the number of operations each shard handles. • Sharding reduces the amount of data that each server needs to store.
  • 26. Data Partitioning Principles Partitioned Data Feeder Virtual Machine Virtual Machine Virtual Machine Back to key scenarios Partitioned Data with Backup Per Partition Feeder Replication Replication Backup 1 Primary 1 Primary 2 Backup 2 Virtual Machine Virtual Machine Virtual Machine Virtual Machine ® Copyright 2012 Gigaspaces Ltd. All Rights Reserved 26
  • 27. Split-brain problem When connectivity between nodes in cluster gone and cluster divided in several parts Solutions: • Optimistic approach (Availability over Consistency) o Leave as is and rely on later resynch (Hazelcast) • Pessimistic approach (Consistency over Availability) o Leave only one partition live before connectivity fixed (MongoDB)
  • 28. Consistency Strong Weak Eventual • After update completes any subsequent access will return the updated value. • The system does not guarantee that subsequent accesses will return the updated value. • The storage system guarantees that if no new updates are made to object eventually all accesses will return the last updated value.
  • 29. Eventually consistent Strong => W + R > N Weak/Eventual => W + R <= N Optimized read => R=1, W=N Optimized write => W=1, R=N N – number of nodes W – number of replicas to aknowledge update R – number of replicas contacted for read
  • 30. Fault tolerance (Architecture concepts) Fault tolerant system: Approaches: • No single point of failure • Fault isolation • Roll-back/Roll-forward procedures • Replication • Redundancy • Diversity – several alternative implementations of some functionality
  • 31. Fault tolerance (Design principles) Design using fault isolated “swimlanes” Never trust single point of failure Avoid putting systems in series Ensure you have “switch on/switch off” for your new functionality
  • 32. Data locality Put data closer to clients scaling by Z-axis. Locate processing units near data to be processed.
  • 33. BASE • Basic Availability • Soft-state • Eventual consistency Alternative model to well known ACID which is used in Distributed Systems to relax strong consistency constraints in favor to achieve higher Availability together with Partition Tolerance as per CAP theorem.
  • 36. Eric Brewer’s quote “Because partitions are rare, CAP should allow perfect C and A most of the time, but when partitions are present or perceived, a strategy that detects partitions and explicitly accounts for them is in order. This strategy should have three steps: detect partitions, enter an explicit partition mode that can limit some operations, and initiate a recovery process to restore consistency and compensate for mistakes made during a partition.”
  • 38. Design principles ® Copyright 2012 Gigaspaces Ltd. All Rights Reserved 38
  • 39. Scaling out (Z/Y/Z axis) [X-Axis]: Horizontal duplication (design to clone things) [Y-Axis]: Split by Function, Service or Resource (design to split diff things) [Z-Axis]: Lookups split (design to split similar things)
  • 40. The art of simplicity KISS (Keep it simple). Don’t overengineer a solution. Simplify solution 3 times over (scope, design, implementation) Reduce DNS lookups. Reduce objects where possible (Google main page) Use homogenous networks where possible Avoid too many traffic redirects Don’t check your work (avoid defensive programing) Relax temporal constraints where possible
  • 41. Aggressive use of caching Use expires headers Cache AJAX calls Leverage Page Caches (Proxy Web Servers) Utilize Application caches Use Object Caches (ORM level) Put caches in their own tier
  • 43. Using messaging whenever possible • Communicate asynchronously as much as possible • Ensure your message bus can scale • Avoid overcrowding your message bus
  • 44. Scaling your database layer Denormalize data where possible cause relationships are costly. Use the right type of lock. Avoid using multiphase commits and distributed transactions. Avoid using “select for update” statements. Don’t select everything.
  • 45. Thank you and questions! Oleg Tsal-Tsalko Email: oleg.tsalko@gmail.com Skype: oleg.tsalko Twitter: @tsaltsol ® Copyright 2012 Gigaspaces Ltd. All Rights Reserved 45