SlideShare a Scribd company logo
1 of 45
Download to read offline
Life After the CAP Theorem
Borémi Toch & Stéphane Lundy
2
Who’s Who ?
@LSrandomBorémi Toch
3
Why are we talking about a theorem ?
4
From Pets to Cattle: Distributed is Becoming The Norm
5
So what’s the goal ?
☉ Understand why the CAP Theorem is
not that practical, but still useful
☉ Give you practical guidelines when
dealing with distributed persistence
☉ Match the system design with the
business stakes
6
From Start...
7
...To Finish
>01 Brewer’s Conjecture
9
What is distributed system ?
A distributed systemNot a distributed system
10
Your guide for the hike: Mr. Eric Brewer
11
You can’t have the whole pie and eat it, Eric Brewer 2000
12
Getting equipped: a tiny bit of theory
13
Consistency (Linearizability)
There must exist a total order on all operations such that each
operation looks as if it were completed at a single instant.
Gilbert, Lynch, 2002
v1 v2 v3
Read ReadWrite(v2) Read=> v3Write(v3)=> v1 => v3
14
Availability
Every request received by a non-failing node in the system must result
in a response.
Gilbert, Lynch, 2002
Client
Request
Response
15
Partition Tolerance
When a network is partitioned, all messages sent from nodes in one component
of the partition to nodes in another component are lost.
Gilbert, Lynch, 2002
Distributed System
16
Partition Tolerance
When a network is partitioned, all messages sent from nodes in one component
of the partition to nodes in another component are lost.
Gilbert, Lynch, 2002
Blue Partition Green Partition
17
The Completely Asynchronous Network Assumption
>02 Brewer’s Refresh
19
2012: Second Take, by Brewer himself
☉ Must read article (available on infoQ)
☉ 12 years of insight into what his original conjecture meant
☉ Easy read with practical examples
20
2015: A Critique of the CAP Theorem, by Martin Kleppmann
☉ Excellent in-depth analysis
☉ Must read to understand the in-depth limitations of the CAP Theorem
☉ Extensive bibliography to dig deeper in the current state of the art
CAP Theorem Dismisses Latency
☉ CAP Theorem ignores latency, even though in practice communications rely on it
☉ Availability and partition state cannot be detected instantaneously
Blue Partition Green Partition
22
No one can actually forfeit Partitions
Consistency and Availability Need Not Be Perfect
☉ The CAP impossibility result holds only for perfect properties
☉ C & A actually range on a spectrum, where tradeoff rules the land
Always return
v0
Return latest
consistent version
Return stale version (vN, N>0)
Eventual Consistency
Super Fragile High Availability
99.999999...
availability
Useless Holy GrailPragmatic Architecture
Consistency
Availability
>03 How To Use It In Practice
25
Easy Peasy Practical Guide
26
Guideline #1: Ask The Partition Question
☉ That’s a system designer question
> Should the system restrict operations ?
> Should the system proceed ?
☉ And a designer question is actually a business decision
What should the system do when a partition occurs ?
27
Guideline #2: Ask The Recovery Question
☉ A system designer has tools to do that, for instance
> Last Writer Wins
> Linearisation
> Compensation
> Human escalation
☉ But in the end that is again a business decision
How should we resolve the partition conflict ?
28
Guideline #0: Don’t Forget That’s Part Of A Risk Analysis
☉ Overdesign lurks on the dark side
☉ System Designers have tools
> KISS: Keep It Simple & Stupid
> Measure, Don’t guess (aka. empiricism, test & learn, short feedback loop…)
☉ What are the risks and impacts ? ask the business people
Is the likelihood worth the complexity ?
29
A nice drawing to clear things up
Time
30
A nice drawing to clear things up
Time
Partition
recovery
Partition
31
Hey but it’s just like
☉ Partition is by design
☉ Merge cannot always be completely
automated
Time
Merge
Local
modifications
>04 Other IT Examples And Patterns
File Synchronization
☉ Partition is by design
☉ Last Writer Wins strategy (LWW) most
of the time
☉ Conflicts are escalated to the user with
file names suffixed with (2), (3)...
Time
Back to base
Offline work
Document Edition
☉ Edition in the browser, with varying
update frequency
☉ Strategies: LWW for whole document
or finer text modifications updates
Time
Merge
Local
modifications
Optimistic Locking
Pessimistic Locking
Relational Databases Management Systems
☉ Pessimistic Locking is about
preventing partitions
☉ Optimistic Locking is about
concurrent editing with a First
Writer Wins strategy
Time
Blockchain Mandatory Mention
☉ Blockchains are decentralised systems
☉ In proof of work systems, the longest
chain, ie. the most powerful alternative
wins
Time
Merge
Uncertainty
>05 Business Already Knows It All
E-commerce: Stock Management
☉ What do you want :
> To check your stock before selling ?
> To sell items as fast as possible ?
☉ What do you need ?
> It depends !
☉ What do you want :
> To check the disponibility of assets ?
> To encourage the cash flow ?
☉ What do you need ?
> It depends !
ATM: Withdrawal or no Withdrawal
☉ What do you want :
> To check users permission ?
> To show the up to date content ?
☉ What do you need ?
> It depends !
Social Media: Timeline Consistency
>06 Wrap-Up
42
So What to Think about the CAP Theorem ?
All models are wrong, but some are useful
George E. P. Box
44
Take Away
☉ Though not practical, the CAP Theorem is not useless
> It helps raise questions about the Consistency-Availability trade-off
> It has fueled many distributed system designs since 2000
☉ Think about Network Partitions when you design systems
> What are the risks ?
> What to do when a partition occurs ?
> What are the rules to recover from a partition ?
☉ You may actually be more familiar with it than you think
> Don’t bicker about being CA, AP, or CP
> You already use some distributed IT tools
☉ Never forget : answers come from the business
45
Initiatives To Keep An Eye On
☉ Conflict-free Replicated Data Types aka. CRDT
> Started with a paper published by Shapiro & al. 2011
> CRDT ensure worry-free partition recovery
> Some products leverage CRDT: Riak, Redis…
☉ Spanner: closing on the CAP impossibility
> Cloud Spanner is a fully managed consistent database
with high availability
> Eric Brewer, now VP of infrastructure at Google has
analysed Spanner in the CAP Theorem perspective
> Leverages Google infrastructure: highly reliable network
& high precision clocks

More Related Content

More from OCTO Technology

OCTO Talks - State of the art Architecture dans les frontend web
OCTO Talks - State of the art Architecture dans les frontend webOCTO Talks - State of the art Architecture dans les frontend web
OCTO Talks - State of the art Architecture dans les frontend webOCTO Technology
 
Comptoir OCTO ALD Automotive/Leaseplan
Comptoir OCTO ALD Automotive/LeaseplanComptoir OCTO ALD Automotive/Leaseplan
Comptoir OCTO ALD Automotive/LeaseplanOCTO Technology
 
Le Comptoir OCTO - Comment optimiser les stocks en linéaire par la Data ?
Le Comptoir OCTO - Comment optimiser les stocks en linéaire par la Data ? Le Comptoir OCTO - Comment optimiser les stocks en linéaire par la Data ?
Le Comptoir OCTO - Comment optimiser les stocks en linéaire par la Data ? OCTO Technology
 
Le Comptoir OCTO - Retour sur 5 ans de mise en oeuvre : Comment le RGPD a réi...
Le Comptoir OCTO - Retour sur 5 ans de mise en oeuvre : Comment le RGPD a réi...Le Comptoir OCTO - Retour sur 5 ans de mise en oeuvre : Comment le RGPD a réi...
Le Comptoir OCTO - Retour sur 5 ans de mise en oeuvre : Comment le RGPD a réi...OCTO Technology
 
Le Comptoir OCTO - Affinez vos forecasts avec la planification distribuée et...
Le Comptoir OCTO -  Affinez vos forecasts avec la planification distribuée et...Le Comptoir OCTO -  Affinez vos forecasts avec la planification distribuée et...
Le Comptoir OCTO - Affinez vos forecasts avec la planification distribuée et...OCTO Technology
 
Le Comptoir OCTO - La formation au cœur de la stratégie d’éco-conception
Le Comptoir OCTO - La formation au cœur de la stratégie d’éco-conceptionLe Comptoir OCTO - La formation au cœur de la stratégie d’éco-conception
Le Comptoir OCTO - La formation au cœur de la stratégie d’éco-conceptionOCTO Technology
 
Le Comptoir OCTO - Une vision de plateforme sans leadership tech n’est qu’hal...
Le Comptoir OCTO - Une vision de plateforme sans leadership tech n’est qu’hal...Le Comptoir OCTO - Une vision de plateforme sans leadership tech n’est qu’hal...
Le Comptoir OCTO - Une vision de plateforme sans leadership tech n’est qu’hal...OCTO Technology
 
Le Comptoir OCTO - L'avenir de la gestion du bilan carbone : les solutions E...
Le Comptoir OCTO - L'avenir de la gestion du bilan carbone :  les solutions E...Le Comptoir OCTO - L'avenir de la gestion du bilan carbone :  les solutions E...
Le Comptoir OCTO - L'avenir de la gestion du bilan carbone : les solutions E...OCTO Technology
 
Le Comptoir OCTO - Continuous discovery et continuous delivery pour construir...
Le Comptoir OCTO - Continuous discovery et continuous delivery pour construir...Le Comptoir OCTO - Continuous discovery et continuous delivery pour construir...
Le Comptoir OCTO - Continuous discovery et continuous delivery pour construir...OCTO Technology
 
RefCard Tests sur tous les fronts
RefCard Tests sur tous les frontsRefCard Tests sur tous les fronts
RefCard Tests sur tous les frontsOCTO Technology
 
RefCard RESTful API Design
RefCard RESTful API DesignRefCard RESTful API Design
RefCard RESTful API DesignOCTO Technology
 
RefCard API Architecture Strategy
RefCard API Architecture StrategyRefCard API Architecture Strategy
RefCard API Architecture StrategyOCTO Technology
 
LA DUCK CONF 2023 - Journal de bord d’un archi dans l’océan du green
LA DUCK CONF 2023 - Journal de bord d’un archi dans l’océan du greenLA DUCK CONF 2023 - Journal de bord d’un archi dans l’océan du green
LA DUCK CONF 2023 - Journal de bord d’un archi dans l’océan du greenOCTO Technology
 
LA DUCK CONF 2023 - Sous le capot du cloud souverain
LA DUCK CONF 2023 - Sous le capot du cloud souverainLA DUCK CONF 2023 - Sous le capot du cloud souverain
LA DUCK CONF 2023 - Sous le capot du cloud souverainOCTO Technology
 
LA DUCK CONF 2023 - Ré-urbanisation d'un SI à travers une archi évolutive
LA DUCK CONF 2023 - Ré-urbanisation d'un SI à travers une archi évolutiveLA DUCK CONF 2023 - Ré-urbanisation d'un SI à travers une archi évolutive
LA DUCK CONF 2023 - Ré-urbanisation d'un SI à travers une archi évolutiveOCTO Technology
 
LA DUCK CONF 2023 - Parce que nos plateformes le valent bien
LA DUCK CONF 2023 - Parce que nos plateformes le valent bienLA DUCK CONF 2023 - Parce que nos plateformes le valent bien
LA DUCK CONF 2023 - Parce que nos plateformes le valent bienOCTO Technology
 
LA DUCK CONF 2023 - Guider, faire, faire faire ? Une solitude partagée entre ...
LA DUCK CONF 2023 - Guider, faire, faire faire ? Une solitude partagée entre ...LA DUCK CONF 2023 - Guider, faire, faire faire ? Une solitude partagée entre ...
LA DUCK CONF 2023 - Guider, faire, faire faire ? Une solitude partagée entre ...OCTO Technology
 
LA DUCK CONF 2023 - Guide de survie du Change Data Capture
LA DUCK CONF 2023 - Guide de survie du Change Data CaptureLA DUCK CONF 2023 - Guide de survie du Change Data Capture
LA DUCK CONF 2023 - Guide de survie du Change Data CaptureOCTO Technology
 
LA DUCK CONF 2023 - Architecture analytics : déjà-vu ?
LA DUCK CONF 2023 - Architecture analytics : déjà-vu ?LA DUCK CONF 2023 - Architecture analytics : déjà-vu ?
LA DUCK CONF 2023 - Architecture analytics : déjà-vu ?OCTO Technology
 

More from OCTO Technology (20)

OCTO Talks - State of the art Architecture dans les frontend web
OCTO Talks - State of the art Architecture dans les frontend webOCTO Talks - State of the art Architecture dans les frontend web
OCTO Talks - State of the art Architecture dans les frontend web
 
Refcard GraphQL
Refcard GraphQLRefcard GraphQL
Refcard GraphQL
 
Comptoir OCTO ALD Automotive/Leaseplan
Comptoir OCTO ALD Automotive/LeaseplanComptoir OCTO ALD Automotive/Leaseplan
Comptoir OCTO ALD Automotive/Leaseplan
 
Le Comptoir OCTO - Comment optimiser les stocks en linéaire par la Data ?
Le Comptoir OCTO - Comment optimiser les stocks en linéaire par la Data ? Le Comptoir OCTO - Comment optimiser les stocks en linéaire par la Data ?
Le Comptoir OCTO - Comment optimiser les stocks en linéaire par la Data ?
 
Le Comptoir OCTO - Retour sur 5 ans de mise en oeuvre : Comment le RGPD a réi...
Le Comptoir OCTO - Retour sur 5 ans de mise en oeuvre : Comment le RGPD a réi...Le Comptoir OCTO - Retour sur 5 ans de mise en oeuvre : Comment le RGPD a réi...
Le Comptoir OCTO - Retour sur 5 ans de mise en oeuvre : Comment le RGPD a réi...
 
Le Comptoir OCTO - Affinez vos forecasts avec la planification distribuée et...
Le Comptoir OCTO -  Affinez vos forecasts avec la planification distribuée et...Le Comptoir OCTO -  Affinez vos forecasts avec la planification distribuée et...
Le Comptoir OCTO - Affinez vos forecasts avec la planification distribuée et...
 
Le Comptoir OCTO - La formation au cœur de la stratégie d’éco-conception
Le Comptoir OCTO - La formation au cœur de la stratégie d’éco-conceptionLe Comptoir OCTO - La formation au cœur de la stratégie d’éco-conception
Le Comptoir OCTO - La formation au cœur de la stratégie d’éco-conception
 
Le Comptoir OCTO - Une vision de plateforme sans leadership tech n’est qu’hal...
Le Comptoir OCTO - Une vision de plateforme sans leadership tech n’est qu’hal...Le Comptoir OCTO - Une vision de plateforme sans leadership tech n’est qu’hal...
Le Comptoir OCTO - Une vision de plateforme sans leadership tech n’est qu’hal...
 
Le Comptoir OCTO - L'avenir de la gestion du bilan carbone : les solutions E...
Le Comptoir OCTO - L'avenir de la gestion du bilan carbone :  les solutions E...Le Comptoir OCTO - L'avenir de la gestion du bilan carbone :  les solutions E...
Le Comptoir OCTO - L'avenir de la gestion du bilan carbone : les solutions E...
 
Le Comptoir OCTO - Continuous discovery et continuous delivery pour construir...
Le Comptoir OCTO - Continuous discovery et continuous delivery pour construir...Le Comptoir OCTO - Continuous discovery et continuous delivery pour construir...
Le Comptoir OCTO - Continuous discovery et continuous delivery pour construir...
 
RefCard Tests sur tous les fronts
RefCard Tests sur tous les frontsRefCard Tests sur tous les fronts
RefCard Tests sur tous les fronts
 
RefCard RESTful API Design
RefCard RESTful API DesignRefCard RESTful API Design
RefCard RESTful API Design
 
RefCard API Architecture Strategy
RefCard API Architecture StrategyRefCard API Architecture Strategy
RefCard API Architecture Strategy
 
LA DUCK CONF 2023 - Journal de bord d’un archi dans l’océan du green
LA DUCK CONF 2023 - Journal de bord d’un archi dans l’océan du greenLA DUCK CONF 2023 - Journal de bord d’un archi dans l’océan du green
LA DUCK CONF 2023 - Journal de bord d’un archi dans l’océan du green
 
LA DUCK CONF 2023 - Sous le capot du cloud souverain
LA DUCK CONF 2023 - Sous le capot du cloud souverainLA DUCK CONF 2023 - Sous le capot du cloud souverain
LA DUCK CONF 2023 - Sous le capot du cloud souverain
 
LA DUCK CONF 2023 - Ré-urbanisation d'un SI à travers une archi évolutive
LA DUCK CONF 2023 - Ré-urbanisation d'un SI à travers une archi évolutiveLA DUCK CONF 2023 - Ré-urbanisation d'un SI à travers une archi évolutive
LA DUCK CONF 2023 - Ré-urbanisation d'un SI à travers une archi évolutive
 
LA DUCK CONF 2023 - Parce que nos plateformes le valent bien
LA DUCK CONF 2023 - Parce que nos plateformes le valent bienLA DUCK CONF 2023 - Parce que nos plateformes le valent bien
LA DUCK CONF 2023 - Parce que nos plateformes le valent bien
 
LA DUCK CONF 2023 - Guider, faire, faire faire ? Une solitude partagée entre ...
LA DUCK CONF 2023 - Guider, faire, faire faire ? Une solitude partagée entre ...LA DUCK CONF 2023 - Guider, faire, faire faire ? Une solitude partagée entre ...
LA DUCK CONF 2023 - Guider, faire, faire faire ? Une solitude partagée entre ...
 
LA DUCK CONF 2023 - Guide de survie du Change Data Capture
LA DUCK CONF 2023 - Guide de survie du Change Data CaptureLA DUCK CONF 2023 - Guide de survie du Change Data Capture
LA DUCK CONF 2023 - Guide de survie du Change Data Capture
 
LA DUCK CONF 2023 - Architecture analytics : déjà-vu ?
LA DUCK CONF 2023 - Architecture analytics : déjà-vu ?LA DUCK CONF 2023 - Architecture analytics : déjà-vu ?
LA DUCK CONF 2023 - Architecture analytics : déjà-vu ?
 

Recently uploaded

GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 

Recently uploaded (20)

GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 

La Duck Conf 2018 : "Life after the CAP Theorem"

  • 1. Life After the CAP Theorem Borémi Toch & Stéphane Lundy
  • 3. 3 Why are we talking about a theorem ?
  • 4. 4 From Pets to Cattle: Distributed is Becoming The Norm
  • 5. 5 So what’s the goal ? ☉ Understand why the CAP Theorem is not that practical, but still useful ☉ Give you practical guidelines when dealing with distributed persistence ☉ Match the system design with the business stakes
  • 9. 9 What is distributed system ? A distributed systemNot a distributed system
  • 10. 10 Your guide for the hike: Mr. Eric Brewer
  • 11. 11 You can’t have the whole pie and eat it, Eric Brewer 2000
  • 12. 12 Getting equipped: a tiny bit of theory
  • 13. 13 Consistency (Linearizability) There must exist a total order on all operations such that each operation looks as if it were completed at a single instant. Gilbert, Lynch, 2002 v1 v2 v3 Read ReadWrite(v2) Read=> v3Write(v3)=> v1 => v3
  • 14. 14 Availability Every request received by a non-failing node in the system must result in a response. Gilbert, Lynch, 2002 Client Request Response
  • 15. 15 Partition Tolerance When a network is partitioned, all messages sent from nodes in one component of the partition to nodes in another component are lost. Gilbert, Lynch, 2002 Distributed System
  • 16. 16 Partition Tolerance When a network is partitioned, all messages sent from nodes in one component of the partition to nodes in another component are lost. Gilbert, Lynch, 2002 Blue Partition Green Partition
  • 17. 17 The Completely Asynchronous Network Assumption
  • 19. 19 2012: Second Take, by Brewer himself ☉ Must read article (available on infoQ) ☉ 12 years of insight into what his original conjecture meant ☉ Easy read with practical examples
  • 20. 20 2015: A Critique of the CAP Theorem, by Martin Kleppmann ☉ Excellent in-depth analysis ☉ Must read to understand the in-depth limitations of the CAP Theorem ☉ Extensive bibliography to dig deeper in the current state of the art
  • 21. CAP Theorem Dismisses Latency ☉ CAP Theorem ignores latency, even though in practice communications rely on it ☉ Availability and partition state cannot be detected instantaneously Blue Partition Green Partition
  • 22. 22 No one can actually forfeit Partitions
  • 23. Consistency and Availability Need Not Be Perfect ☉ The CAP impossibility result holds only for perfect properties ☉ C & A actually range on a spectrum, where tradeoff rules the land Always return v0 Return latest consistent version Return stale version (vN, N>0) Eventual Consistency Super Fragile High Availability 99.999999... availability Useless Holy GrailPragmatic Architecture Consistency Availability
  • 24. >03 How To Use It In Practice
  • 26. 26 Guideline #1: Ask The Partition Question ☉ That’s a system designer question > Should the system restrict operations ? > Should the system proceed ? ☉ And a designer question is actually a business decision What should the system do when a partition occurs ?
  • 27. 27 Guideline #2: Ask The Recovery Question ☉ A system designer has tools to do that, for instance > Last Writer Wins > Linearisation > Compensation > Human escalation ☉ But in the end that is again a business decision How should we resolve the partition conflict ?
  • 28. 28 Guideline #0: Don’t Forget That’s Part Of A Risk Analysis ☉ Overdesign lurks on the dark side ☉ System Designers have tools > KISS: Keep It Simple & Stupid > Measure, Don’t guess (aka. empiricism, test & learn, short feedback loop…) ☉ What are the risks and impacts ? ask the business people Is the likelihood worth the complexity ?
  • 29. 29 A nice drawing to clear things up Time
  • 30. 30 A nice drawing to clear things up Time Partition recovery Partition
  • 31. 31 Hey but it’s just like ☉ Partition is by design ☉ Merge cannot always be completely automated Time Merge Local modifications
  • 32. >04 Other IT Examples And Patterns
  • 33. File Synchronization ☉ Partition is by design ☉ Last Writer Wins strategy (LWW) most of the time ☉ Conflicts are escalated to the user with file names suffixed with (2), (3)... Time Back to base Offline work
  • 34. Document Edition ☉ Edition in the browser, with varying update frequency ☉ Strategies: LWW for whole document or finer text modifications updates Time Merge Local modifications
  • 35. Optimistic Locking Pessimistic Locking Relational Databases Management Systems ☉ Pessimistic Locking is about preventing partitions ☉ Optimistic Locking is about concurrent editing with a First Writer Wins strategy Time
  • 36. Blockchain Mandatory Mention ☉ Blockchains are decentralised systems ☉ In proof of work systems, the longest chain, ie. the most powerful alternative wins Time Merge Uncertainty
  • 37. >05 Business Already Knows It All
  • 38. E-commerce: Stock Management ☉ What do you want : > To check your stock before selling ? > To sell items as fast as possible ? ☉ What do you need ? > It depends !
  • 39. ☉ What do you want : > To check the disponibility of assets ? > To encourage the cash flow ? ☉ What do you need ? > It depends ! ATM: Withdrawal or no Withdrawal
  • 40. ☉ What do you want : > To check users permission ? > To show the up to date content ? ☉ What do you need ? > It depends ! Social Media: Timeline Consistency
  • 42. 42
  • 43. So What to Think about the CAP Theorem ? All models are wrong, but some are useful George E. P. Box
  • 44. 44 Take Away ☉ Though not practical, the CAP Theorem is not useless > It helps raise questions about the Consistency-Availability trade-off > It has fueled many distributed system designs since 2000 ☉ Think about Network Partitions when you design systems > What are the risks ? > What to do when a partition occurs ? > What are the rules to recover from a partition ? ☉ You may actually be more familiar with it than you think > Don’t bicker about being CA, AP, or CP > You already use some distributed IT tools ☉ Never forget : answers come from the business
  • 45. 45 Initiatives To Keep An Eye On ☉ Conflict-free Replicated Data Types aka. CRDT > Started with a paper published by Shapiro & al. 2011 > CRDT ensure worry-free partition recovery > Some products leverage CRDT: Riak, Redis… ☉ Spanner: closing on the CAP impossibility > Cloud Spanner is a fully managed consistent database with high availability > Eric Brewer, now VP of infrastructure at Google has analysed Spanner in the CAP Theorem perspective > Leverages Google infrastructure: highly reliable network & high precision clocks