SlideShare a Scribd company logo
Tale of a
growing
startup
Praveen Singh Bora
Rajesh Kumar
Once upon a
time…
There was
a koala
And I was in vicinity too, So I did the
only thing that came immediately to
my mind
I shot it…
With the
camera of
course
I of course uploaded the
pictures and they were a huge
hit
I created my own
website
Koality
Very first
problem
I wanted to
store likes of a
particular
picture
It was not hard and I
stored the likes counter
in RDBMS 42
Soon the
usage
soared all
over the
world
o Master Slave
architecture
o Master Master
architecture aka Multi
Master
Replicate
d the
instances
all over
the world.
Still RDBMS is not able to keep up
RDBMS provide active
active architecture, but
with 2PC
o Blocking architecture
o 2PC is notoriously
slow.
o 2PC can get stuck in
a transaction when
coordinator dies.
2PC
Limitatio
ns
Who wants to be seen doing
RDBMS these days?
Considering NoSQLs
Can I safely say scaling is not a problem with
NoSQLs?
What about
data
consistency?
Strong consistency
Eventual consistency
o Events are processed as
soon as they happen
o All or nothing operation
o ACID Compliant
o Also known as
linearizability
o No concurrent updates
o E.g. XA transactions
Strong
Consisten
cy
o Events are not eventually
processed
o Exchanges versions of
data
o Reconciling final state
o System may be in
inconsistent state but
eventually will be consistent
o Allows concurrent updates
o E.g. Peer to peer systems,
No Sql databases etc
Eventual
Consisten
cy
A lot to
choose
from?
But which of them
are matured and
asynchronous
master-less
replication?
o Last Writer Wins
o CRDTs
o Operational
Transformation
no sql
Conflict
Resolutio
n
Strategies
Add +1
TS: T1
Add +9
TS: T2
200C
200C
201C
209C
Last Writer
Wins
209C
Value 201
Discarded
We have
Data
Consistency
issues
What we
learnt from
our
endeavor
so far
If you tried
your best and
failed
Lesson is,
NEVER TRY
CRDTs provide a way for you
to merge concurrent
modifications, always, in
any order.
e.g. Set Union, Max
operation on number
Conflict
Free
Replicated
Data
Types
o Special case of
Eventual consistency
o Valid only for certain
data types known as
Conflict Free Replicated
Data types aka CRDTs
Strong
Eventual
Consisten
cy
o Convergent replicated data types
o Sends full local state in operation
hence called state based CRDTs
o Commutative: A ✧ B = B ✧ A
o Associative: A ✧ (B ✧ C) = (A ✧ B)
✧ C
o Idempotent: A ✧ A = A
CvRDTs
o Commutative replicated data
types
o Only transmit the update
part hence called operation
based CRDTs
o Commutative: A ✧ B = B ✧
A
CmRDTs
Join
Semilattice
o A graph that converges in on
a single ascendant
o This single ascendant is
known as the least upper
bound
o Two objects can be either
equal, have hierarchy or are
pairs
{ 1, 0,
0 }
{ 0, 1,
0 }
{ 0, 0,
1 }
{ 0, 0,
0 }
{ 1, 1,
0 }
{ 0, 1,
1 }
{ 1, 1,
1 }
Merging of
states
Grow
Only
Set
Add = {AD1, AD2}
Rem = {AD2}A B
C
Add = {AD1, AD2}
Rem = {AD2}
Add = {AD1, AD2}
Rem = {AD2}
Rem
AD1
Add
AD4
Add
AD3
Concurrent
Updates
On
All Nodes
Initial
State
Add = {AD1, AD2}
Rem = {AD2, AD1}A B
C
Add = {AD1, AD2,
AD3}
Rem = {AD2}
Add = {AD1, AD2,
AD4}
Rem = {AD2}
Immediate
Nodes
Updated
Add = {AD1, AD2}
Rem = {AD2, AD1}A B
C
Add = {AD1, AD2,
AD3}
Rem = {AD2}
Add = {AD1, AD2,
AD4}
Rem = {AD2}
Nodes
Syncing
Add = {AD1, AD2}
Rem = {AD2, AD1}
Add = {AD1, AD2,
AD3}
Rem = {AD2}
Add = {AD1, AD2,
AD4}
Rem = {AD2}
Add = {AD1, AD2,
AD4}
Rem = {AD2}
Add = {AD1, AD2}
Rem = {AD2, AD1}
Add = {AD1, AD2,
AD3}
Rem = {AD2}
Add = {AD1, AD2,
AD3, AD4}
Rem = {AD1, AD2}
A B
C
Add = {AD1, AD2,
AD3, AD4}
Rem = {AD1, AD2}
Add = {AD1, AD2,
AD3, AD4}
Rem = {AD1, AD2}
Nodes
Synced
Revisit
the
counter
o Grow counter is a value
that can be
incremented by any
positive integer.
o All nodes keep version
vector values.
o The merge function
while reconciliation
takes the max value of
version.
Grow
Only
Counter
A = {0,
0}
B = {0,
0}
C = {0,
0}
A = {0,
0}
B = {0,
0}
C = {0,
0}
A = {0,
0}
B = {0,
0}
C = {0,
0}
A B
C
Initial
State
incr 2 incr 3
incr 5
Concurren
t
Updates
Received
Immediate
Nodes
Updated
A = {2,
1}
B = {0,
0}
C = {0,
0}
A = {0,
0}
B = {3,
1}
C = {0,
0}
A = {0,
0}
B = {0,
0}
C = {5,
1}
A B
C
A = {2,
1}
B = {0,
0}
C = {0,
0}
A = {0,
0}
B = {3,
1}
C = {0,
0}
A = {0,
0}
B = {0,
0}
C = {5,
1}
A = {0,
0}
B = {0,
0}
C = {5,
1}
A = {2,
1}
B = {0,
0}
C = {0,
0}
A = {0,
0}
B = {3,
1}
C = {0,
0}
Nodes
Syncing
A = {2,
1}
B = {3,
1}
C = {5,
1}
A = {2,
1}
B = {3,
1}
C = {5,
1}
A = {2,
1}
B = {3,
1}
C = {5,
1}
A B
C
Nodes
Synced
CRDT
Design
Rules
o New values must always
be greater than previous
values
o Conflicting updates
must always produce
sibling values
o Resolution must always
result in values greater
than participants
o Last writer wins Set
o OR Sets
o Observed Remove Map
o Grow Only Map
o Last Writer Wins Map
o Add only Monotonic
DAG
o Replicated Growable
Array
Other
Data
Structures
o Redis uses CRDTs for
distributed databases.
o SoundCloud Roshi, a
LWW-element-set on top
of Redis.
o Riak is a distributed key-
value data store based on
CRDTs.
o TomTom employs CRDTs
to synchronize navigation
data.
Industry
Usage
o Facebook implements
CRDTs in their Apollo
database.
o Teletype for Atom
employs CRDTs.
o Microsoft's Cosmos DB
uses CRDT's to enable a
multi-master write
mode.
Industry
Usage
Continued
Distributed system sans consensus
Distributed system sans consensus

More Related Content

Similar to Distributed system sans consensus

Kyryl Sablin Crdt and their uses
Kyryl Sablin Crdt and their usesKyryl Sablin Crdt and their uses
Kyryl Sablin Crdt and their uses
Аліна Шепшелей
 
SE2016 Exotic Kyryl Sablin "CRDT and their uses"
SE2016 Exotic Kyryl Sablin "CRDT and their uses"SE2016 Exotic Kyryl Sablin "CRDT and their uses"
SE2016 Exotic Kyryl Sablin "CRDT and their uses"
Inhacking
 
Self healing data
Self healing dataSelf healing data
Self healing data
Uwe Friedrichsen
 
Planning Under Uncertainty With Markov Decision Processes
Planning Under Uncertainty With Markov Decision ProcessesPlanning Under Uncertainty With Markov Decision Processes
Planning Under Uncertainty With Markov Decision Processes
ahmad bassiouny
 
CPP Homework Help
CPP Homework HelpCPP Homework Help
CPP Homework Help
C++ Homework Help
 
Eventually-Consistent Data Structures
Eventually-Consistent Data StructuresEventually-Consistent Data Structures
Eventually-Consistent Data Structures
Sean Cribbs
 
Ranking systems
Ranking systemsRanking systems
Ranking systems
Mafer
 
Ranking systems
Ranking systemsRanking systems
Ranking systems
Joyce
 
Super TypeScript II Turbo - FP Remix (NG Conf 2017)
Super TypeScript II Turbo - FP Remix (NG Conf 2017)Super TypeScript II Turbo - FP Remix (NG Conf 2017)
Super TypeScript II Turbo - FP Remix (NG Conf 2017)
Sean May
 
Understanding JVM GC: advanced!
Understanding JVM GC: advanced!Understanding JVM GC: advanced!
Understanding JVM GC: advanced!
Jean-Philippe BEMPEL
 
Practical Consistency
Practical ConsistencyPractical Consistency
Practical Consistency
David Golden
 
Everyday I'm Shuffling - Tips for Writing Better Spark Programs, Strata San J...
Everyday I'm Shuffling - Tips for Writing Better Spark Programs, Strata San J...Everyday I'm Shuffling - Tips for Writing Better Spark Programs, Strata San J...
Everyday I'm Shuffling - Tips for Writing Better Spark Programs, Strata San J...
Databricks
 
Parallel Computing 2007: Bring your own parallel application
Parallel Computing 2007: Bring your own parallel applicationParallel Computing 2007: Bring your own parallel application
Parallel Computing 2007: Bring your own parallel application
Geoffrey Fox
 
Eventually Consistent Data Structures (from strangeloop12)
Eventually Consistent Data Structures (from strangeloop12)Eventually Consistent Data Structures (from strangeloop12)
Eventually Consistent Data Structures (from strangeloop12)
Sean Cribbs
 
Realtime Analytics
Realtime AnalyticsRealtime Analytics
Realtime Analytics
eXascale Infolab
 
Building a Scalable Distributed Stats Infrastructure with Storm and KairosDB
Building a Scalable Distributed Stats Infrastructure with Storm and KairosDBBuilding a Scalable Distributed Stats Infrastructure with Storm and KairosDB
Building a Scalable Distributed Stats Infrastructure with Storm and KairosDB
Cody Ray
 
Speeding Up Distributed Machine Learning Using Codes
Speeding Up Distributed Machine Learning Using CodesSpeeding Up Distributed Machine Learning Using Codes
Speeding Up Distributed Machine Learning Using Codes
NAVER Engineering
 
Gor Nishanov, C++ Coroutines – a negative overhead abstraction
Gor Nishanov,  C++ Coroutines – a negative overhead abstractionGor Nishanov,  C++ Coroutines – a negative overhead abstraction
Gor Nishanov, C++ Coroutines – a negative overhead abstraction
Sergey Platonov
 
determinants-160504230830.pdf
determinants-160504230830.pdfdeterminants-160504230830.pdf
determinants-160504230830.pdf
Praveen Kumar Verma PMP
 
determinants-160504230830_repaired.pdf
determinants-160504230830_repaired.pdfdeterminants-160504230830_repaired.pdf
determinants-160504230830_repaired.pdf
TGBSmile
 

Similar to Distributed system sans consensus (20)

Kyryl Sablin Crdt and their uses
Kyryl Sablin Crdt and their usesKyryl Sablin Crdt and their uses
Kyryl Sablin Crdt and their uses
 
SE2016 Exotic Kyryl Sablin "CRDT and their uses"
SE2016 Exotic Kyryl Sablin "CRDT and their uses"SE2016 Exotic Kyryl Sablin "CRDT and their uses"
SE2016 Exotic Kyryl Sablin "CRDT and their uses"
 
Self healing data
Self healing dataSelf healing data
Self healing data
 
Planning Under Uncertainty With Markov Decision Processes
Planning Under Uncertainty With Markov Decision ProcessesPlanning Under Uncertainty With Markov Decision Processes
Planning Under Uncertainty With Markov Decision Processes
 
CPP Homework Help
CPP Homework HelpCPP Homework Help
CPP Homework Help
 
Eventually-Consistent Data Structures
Eventually-Consistent Data StructuresEventually-Consistent Data Structures
Eventually-Consistent Data Structures
 
Ranking systems
Ranking systemsRanking systems
Ranking systems
 
Ranking systems
Ranking systemsRanking systems
Ranking systems
 
Super TypeScript II Turbo - FP Remix (NG Conf 2017)
Super TypeScript II Turbo - FP Remix (NG Conf 2017)Super TypeScript II Turbo - FP Remix (NG Conf 2017)
Super TypeScript II Turbo - FP Remix (NG Conf 2017)
 
Understanding JVM GC: advanced!
Understanding JVM GC: advanced!Understanding JVM GC: advanced!
Understanding JVM GC: advanced!
 
Practical Consistency
Practical ConsistencyPractical Consistency
Practical Consistency
 
Everyday I'm Shuffling - Tips for Writing Better Spark Programs, Strata San J...
Everyday I'm Shuffling - Tips for Writing Better Spark Programs, Strata San J...Everyday I'm Shuffling - Tips for Writing Better Spark Programs, Strata San J...
Everyday I'm Shuffling - Tips for Writing Better Spark Programs, Strata San J...
 
Parallel Computing 2007: Bring your own parallel application
Parallel Computing 2007: Bring your own parallel applicationParallel Computing 2007: Bring your own parallel application
Parallel Computing 2007: Bring your own parallel application
 
Eventually Consistent Data Structures (from strangeloop12)
Eventually Consistent Data Structures (from strangeloop12)Eventually Consistent Data Structures (from strangeloop12)
Eventually Consistent Data Structures (from strangeloop12)
 
Realtime Analytics
Realtime AnalyticsRealtime Analytics
Realtime Analytics
 
Building a Scalable Distributed Stats Infrastructure with Storm and KairosDB
Building a Scalable Distributed Stats Infrastructure with Storm and KairosDBBuilding a Scalable Distributed Stats Infrastructure with Storm and KairosDB
Building a Scalable Distributed Stats Infrastructure with Storm and KairosDB
 
Speeding Up Distributed Machine Learning Using Codes
Speeding Up Distributed Machine Learning Using CodesSpeeding Up Distributed Machine Learning Using Codes
Speeding Up Distributed Machine Learning Using Codes
 
Gor Nishanov, C++ Coroutines – a negative overhead abstraction
Gor Nishanov,  C++ Coroutines – a negative overhead abstractionGor Nishanov,  C++ Coroutines – a negative overhead abstraction
Gor Nishanov, C++ Coroutines – a negative overhead abstraction
 
determinants-160504230830.pdf
determinants-160504230830.pdfdeterminants-160504230830.pdf
determinants-160504230830.pdf
 
determinants-160504230830_repaired.pdf
determinants-160504230830_repaired.pdfdeterminants-160504230830_repaired.pdf
determinants-160504230830_repaired.pdf
 

Recently uploaded

Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
tolgahangng
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
Matthew Sinclair
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Safe Software
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
Neo4j
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
DianaGray10
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
Neo4j
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
Zilliz
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
DianaGray10
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
Neo4j
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
Zilliz
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
Tomaz Bratanic
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
kumardaparthi1024
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
DianaGray10
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
Adtran
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
SOFTTECHHUB
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Malak Abu Hammad
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
innovationoecd
 

Recently uploaded (20)

Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
 

Distributed system sans consensus

  • 1. Tale of a growing startup Praveen Singh Bora Rajesh Kumar
  • 4. And I was in vicinity too, So I did the only thing that came immediately to my mind
  • 7. I of course uploaded the pictures and they were a huge hit I created my own website
  • 9. Very first problem I wanted to store likes of a particular picture
  • 10. It was not hard and I stored the likes counter in RDBMS 42
  • 12. o Master Slave architecture o Master Master architecture aka Multi Master Replicate d the instances all over the world.
  • 13. Still RDBMS is not able to keep up
  • 14. RDBMS provide active active architecture, but with 2PC
  • 15. o Blocking architecture o 2PC is notoriously slow. o 2PC can get stuck in a transaction when coordinator dies. 2PC Limitatio ns
  • 16. Who wants to be seen doing RDBMS these days?
  • 18. Can I safely say scaling is not a problem with NoSQLs?
  • 21. o Events are processed as soon as they happen o All or nothing operation o ACID Compliant o Also known as linearizability o No concurrent updates o E.g. XA transactions Strong Consisten cy
  • 22. o Events are not eventually processed o Exchanges versions of data o Reconciling final state o System may be in inconsistent state but eventually will be consistent o Allows concurrent updates o E.g. Peer to peer systems, No Sql databases etc Eventual Consisten cy
  • 24. But which of them are matured and asynchronous master-less replication?
  • 25. o Last Writer Wins o CRDTs o Operational Transformation no sql Conflict Resolutio n Strategies
  • 26. Add +1 TS: T1 Add +9 TS: T2 200C 200C 201C 209C Last Writer Wins 209C Value 201 Discarded
  • 29. If you tried your best and failed Lesson is, NEVER TRY
  • 30. CRDTs provide a way for you to merge concurrent modifications, always, in any order. e.g. Set Union, Max operation on number Conflict Free Replicated Data Types
  • 31. o Special case of Eventual consistency o Valid only for certain data types known as Conflict Free Replicated Data types aka CRDTs Strong Eventual Consisten cy
  • 32. o Convergent replicated data types o Sends full local state in operation hence called state based CRDTs o Commutative: A ✧ B = B ✧ A o Associative: A ✧ (B ✧ C) = (A ✧ B) ✧ C o Idempotent: A ✧ A = A CvRDTs
  • 33. o Commutative replicated data types o Only transmit the update part hence called operation based CRDTs o Commutative: A ✧ B = B ✧ A CmRDTs
  • 34. Join Semilattice o A graph that converges in on a single ascendant o This single ascendant is known as the least upper bound o Two objects can be either equal, have hierarchy or are pairs
  • 35. { 1, 0, 0 } { 0, 1, 0 } { 0, 0, 1 } { 0, 0, 0 } { 1, 1, 0 } { 0, 1, 1 } { 1, 1, 1 } Merging of states
  • 37. Add = {AD1, AD2} Rem = {AD2}A B C Add = {AD1, AD2} Rem = {AD2} Add = {AD1, AD2} Rem = {AD2} Rem AD1 Add AD4 Add AD3 Concurrent Updates On All Nodes Initial State
  • 38. Add = {AD1, AD2} Rem = {AD2, AD1}A B C Add = {AD1, AD2, AD3} Rem = {AD2} Add = {AD1, AD2, AD4} Rem = {AD2} Immediate Nodes Updated
  • 39. Add = {AD1, AD2} Rem = {AD2, AD1}A B C Add = {AD1, AD2, AD3} Rem = {AD2} Add = {AD1, AD2, AD4} Rem = {AD2} Nodes Syncing Add = {AD1, AD2} Rem = {AD2, AD1} Add = {AD1, AD2, AD3} Rem = {AD2} Add = {AD1, AD2, AD4} Rem = {AD2} Add = {AD1, AD2, AD4} Rem = {AD2} Add = {AD1, AD2} Rem = {AD2, AD1} Add = {AD1, AD2, AD3} Rem = {AD2}
  • 40. Add = {AD1, AD2, AD3, AD4} Rem = {AD1, AD2} A B C Add = {AD1, AD2, AD3, AD4} Rem = {AD1, AD2} Add = {AD1, AD2, AD3, AD4} Rem = {AD1, AD2} Nodes Synced
  • 42. o Grow counter is a value that can be incremented by any positive integer. o All nodes keep version vector values. o The merge function while reconciliation takes the max value of version. Grow Only Counter
  • 43. A = {0, 0} B = {0, 0} C = {0, 0} A = {0, 0} B = {0, 0} C = {0, 0} A = {0, 0} B = {0, 0} C = {0, 0} A B C Initial State incr 2 incr 3 incr 5 Concurren t Updates Received
  • 44. Immediate Nodes Updated A = {2, 1} B = {0, 0} C = {0, 0} A = {0, 0} B = {3, 1} C = {0, 0} A = {0, 0} B = {0, 0} C = {5, 1} A B C A = {2, 1} B = {0, 0} C = {0, 0} A = {0, 0} B = {3, 1} C = {0, 0} A = {0, 0} B = {0, 0} C = {5, 1} A = {0, 0} B = {0, 0} C = {5, 1} A = {2, 1} B = {0, 0} C = {0, 0} A = {0, 0} B = {3, 1} C = {0, 0} Nodes Syncing
  • 45. A = {2, 1} B = {3, 1} C = {5, 1} A = {2, 1} B = {3, 1} C = {5, 1} A = {2, 1} B = {3, 1} C = {5, 1} A B C Nodes Synced
  • 46. CRDT Design Rules o New values must always be greater than previous values o Conflicting updates must always produce sibling values o Resolution must always result in values greater than participants
  • 47. o Last writer wins Set o OR Sets o Observed Remove Map o Grow Only Map o Last Writer Wins Map o Add only Monotonic DAG o Replicated Growable Array Other Data Structures
  • 48. o Redis uses CRDTs for distributed databases. o SoundCloud Roshi, a LWW-element-set on top of Redis. o Riak is a distributed key- value data store based on CRDTs. o TomTom employs CRDTs to synchronize navigation data. Industry Usage
  • 49. o Facebook implements CRDTs in their Apollo database. o Teletype for Atom employs CRDTs. o Microsoft's Cosmos DB uses CRDT's to enable a multi-master write mode. Industry Usage Continued

Editor's Notes

  1. Describe scaling, why it is important
  2. Describe scaling, why it is important
  3. Describe scaling, why it is important
  4. Describe scaling, why it is important
  5. Describe scaling, why it is important
  6. Describe scaling, why it is important
  7. Describe scaling, why it is important
  8. Describe scaling, why it is important
  9. Describe scaling, why it is important
  10. Describe scaling, why it is important
  11. Describe scaling, why it is important
  12. Describe scaling, why it is important
  13. Describe scaling, why it is important
  14. Describe scaling, why it is important
  15. Describe scaling, why it is important
  16. Describe scaling, why it is important
  17. Describe scaling, why it is important
  18. Describe scaling, why it is important