42
Bernard Ourghanlian @Ourghanlian CTO & CSO – Microsoft France

Bernard Ourghanlian @Ourghanlian CTO & CSO Microsoft France · Le théorème PACELC (Abadi, 2010, formalisé en 2012) In a system that replicates data: 1. If a partition (P) is detected,

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Bernard Ourghanlian @Ourghanlian CTO & CSO Microsoft France · Le théorème PACELC (Abadi, 2010, formalisé en 2012) In a system that replicates data: 1. If a partition (P) is detected,

Bernard Ourghanlian @Ourghanlian

CTO & CSO – Microsoft France

Page 2: Bernard Ourghanlian @Ourghanlian CTO & CSO Microsoft France · Le théorème PACELC (Abadi, 2010, formalisé en 2012) In a system that replicates data: 1. If a partition (P) is detected,

In addition to the revenue impact of lost sales, the bigger impact is the loyal customers a brand might lose from having a non-functioning website on one of the biggest shopping days of the year.

- Mehdi Daoudi, CEO Catchpoint

Page 3: Bernard Ourghanlian @Ourghanlian CTO & CSO Microsoft France · Le théorème PACELC (Abadi, 2010, formalisé en 2012) In a system that replicates data: 1. If a partition (P) is detected,
Page 4: Bernard Ourghanlian @Ourghanlian CTO & CSO Microsoft France · Le théorème PACELC (Abadi, 2010, formalisé en 2012) In a system that replicates data: 1. If a partition (P) is detected,
Page 5: Bernard Ourghanlian @Ourghanlian CTO & CSO Microsoft France · Le théorème PACELC (Abadi, 2010, formalisé en 2012) In a system that replicates data: 1. If a partition (P) is detected,

https://people.eecs.berkeley.edu/~brewer/cs262b-2004/PODC-keynote.pdf

Page 6: Bernard Ourghanlian @Ourghanlian CTO & CSO Microsoft France · Le théorème PACELC (Abadi, 2010, formalisé en 2012) In a system that replicates data: 1. If a partition (P) is detected,

A

Atomicity

C

Consistency

I

Isolation

D

Durability

Page 7: Bernard Ourghanlian @Ourghanlian CTO & CSO Microsoft France · Le théorème PACELC (Abadi, 2010, formalisé en 2012) In a system that replicates data: 1. If a partition (P) is detected,
Page 8: Bernard Ourghanlian @Ourghanlian CTO & CSO Microsoft France · Le théorème PACELC (Abadi, 2010, formalisé en 2012) In a system that replicates data: 1. If a partition (P) is detected,

Le théorème CAP, aussi connu sous le nom de théorème de Brewer dit qu’il est impossible sur un système distribué de garantir en même temps (c’est-à-dire de manière synchrone) les trois contraintes suivantes : • Cohérence (Consistency en anglais) : tous les nœuds du

système voient exactement les mêmes données au même moment ;

• Disponibilité (Availability en anglais) : garantie que toutes les requêtes reçoivent une réponse;

• Tolérance au partitionnement (Partition Tolerance en anglais) : aucune panne moins importante qu’une coupure totale du réseau ne doit empêcher le système de répondre correctement (ou encore : en cas de morcellement en sous-réseaux, chacun doit pouvoir fonctionner de manière autonome).

S. Gilbert and N. Lynch, “Brewer’s Conjecture and the Feasibility of Consistent, Available, Partition-Tolerant

Web Services,” ACM SIGACT News, June 2002, pp. 51-59.

Page 9: Bernard Ourghanlian @Ourghanlian CTO & CSO Microsoft France · Le théorème PACELC (Abadi, 2010, formalisé en 2012) In a system that replicates data: 1. If a partition (P) is detected,

Master Replica

Consistency

Availability

Partition tolerance

Page 10: Bernard Ourghanlian @Ourghanlian CTO & CSO Microsoft France · Le théorème PACELC (Abadi, 2010, formalisé en 2012) In a system that replicates data: 1. If a partition (P) is detected,

Master Replica

Page 11: Bernard Ourghanlian @Ourghanlian CTO & CSO Microsoft France · Le théorème PACELC (Abadi, 2010, formalisé en 2012) In a system that replicates data: 1. If a partition (P) is detected,

http://dbmsmusings.blogspot.com/2010/04/problems-with-cap-and-yahoos-little.html

Page 12: Bernard Ourghanlian @Ourghanlian CTO & CSO Microsoft France · Le théorème PACELC (Abadi, 2010, formalisé en 2012) In a system that replicates data: 1. If a partition (P) is detected,

LATENCELatence = Combien de temps une demande client doit-elle attendre votre réponse ?

Page 13: Bernard Ourghanlian @Ourghanlian CTO & CSO Microsoft France · Le théorème PACELC (Abadi, 2010, formalisé en 2012) In a system that replicates data: 1. If a partition (P) is detected,

Imaginez avoir à répliquer les données à travers

le monde…

Page 14: Bernard Ourghanlian @Ourghanlian CTO & CSO Microsoft France · Le théorème PACELC (Abadi, 2010, formalisé en 2012) In a system that replicates data: 1. If a partition (P) is detected,

“A high availability requirement implies

that the system must replicate data.

But as soon as a distributed system

replicates data, a tradeoff between

consistency and latency arises.”

Abadi 2010

Page 15: Bernard Ourghanlian @Ourghanlian CTO & CSO Microsoft France · Le théorème PACELC (Abadi, 2010, formalisé en 2012) In a system that replicates data: 1. If a partition (P) is detected,

Le théorème PACELC (Abadi, 2010, formalisé en

2012)In a system that replicates data:

1. If a partition (P) is detected, how does the system trade off○ (A) Availability or○ (C) Consistency

2. Else (E) how does the system trade off○ (L) Latency or○ (C) Consistency

Abadi, Daniel J. “Consistency Tradeoffs in Modern Distributed Database System Design”, Yale University

http://cs-www.cs.yale.edu/homes/dna/papers/abadi-pacelc.pdf

Page 16: Bernard Ourghanlian @Ourghanlian CTO & CSO Microsoft France · Le théorème PACELC (Abadi, 2010, formalisé en 2012) In a system that replicates data: 1. If a partition (P) is detected,

Master Replica

In the case of network Partitioning in a distributed computer system, one

has to choose between Availability and Consistency, but Else, even when

the system is running normally in the absence of partitions, one has to

choose between Latency and Consistency.

Page 17: Bernard Ourghanlian @Ourghanlian CTO & CSO Microsoft France · Le théorème PACELC (Abadi, 2010, formalisé en 2012) In a system that replicates data: 1. If a partition (P) is detected,

Master Replica

Page 18: Bernard Ourghanlian @Ourghanlian CTO & CSO Microsoft France · Le théorème PACELC (Abadi, 2010, formalisé en 2012) In a system that replicates data: 1. If a partition (P) is detected,
Page 19: Bernard Ourghanlian @Ourghanlian CTO & CSO Microsoft France · Le théorème PACELC (Abadi, 2010, formalisé en 2012) In a system that replicates data: 1. If a partition (P) is detected,
Page 20: Bernard Ourghanlian @Ourghanlian CTO & CSO Microsoft France · Le théorème PACELC (Abadi, 2010, formalisé en 2012) In a system that replicates data: 1. If a partition (P) is detected,
Page 21: Bernard Ourghanlian @Ourghanlian CTO & CSO Microsoft France · Le théorème PACELC (Abadi, 2010, formalisé en 2012) In a system that replicates data: 1. If a partition (P) is detected,
Page 22: Bernard Ourghanlian @Ourghanlian CTO & CSO Microsoft France · Le théorème PACELC (Abadi, 2010, formalisé en 2012) In a system that replicates data: 1. If a partition (P) is detected,

Cohérence forte

Latence élevée

Cohérence éventuelle,

Latence faible

Choix pour la plupart des applications distribuées

Page 23: Bernard Ourghanlian @Ourghanlian CTO & CSO Microsoft France · Le théorème PACELC (Abadi, 2010, formalisé en 2012) In a system that replicates data: 1. If a partition (P) is detected,

Les bases de données sont essentiellement divisées en deux catégories Celles qui procurent les choix extrêmes – forte vs. Cohérence

éventuelle (par ex. DynamoDB)

Celles qui laissent tout à configurer aux développeurs (par ex. Cassandra) Réparation de lecture, transfert suggéré, tailles de quorum, topologies de réplication, etc.

Les développeurs ont à faire des compromis précis entre Cohérence et disponibilité (pendant les défaillances)

Cohérence et latence (à l’état normal)

Cohérence et débit (ceci est important pour des raisons de TCO)

Page 24: Bernard Ourghanlian @Ourghanlian CTO & CSO Microsoft France · Le théorème PACELC (Abadi, 2010, formalisé en 2012) In a system that replicates data: 1. If a partition (P) is detected,

Il est possible de mettre en œuvre 5 niveaux de cohérence bien définis pour une faible

latence et une haute disponibilité

Strong Bounded-stateless Session Consistent prefix Eventual

La plupart des applications de la vie réelle ne tombent pas dans ces deux extrêmes

Page 25: Bernard Ourghanlian @Ourghanlian CTO & CSO Microsoft France · Le théorème PACELC (Abadi, 2010, formalisé en 2012) In a system that replicates data: 1. If a partition (P) is detected,

01

Strong

Bounded

Staleness

Session

Consistent

Prefix

Eventual

Compromis clairs

• Latence

• Disponibilité

• Débit

Page 26: Bernard Ourghanlian @Ourghanlian CTO & CSO Microsoft France · Le théorème PACELC (Abadi, 2010, formalisé en 2012) In a system that replicates data: 1. If a partition (P) is detected,
Page 27: Bernard Ourghanlian @Ourghanlian CTO & CSO Microsoft France · Le théorème PACELC (Abadi, 2010, formalisé en 2012) In a system that replicates data: 1. If a partition (P) is detected,
Page 28: Bernard Ourghanlian @Ourghanlian CTO & CSO Microsoft France · Le théorème PACELC (Abadi, 2010, formalisé en 2012) In a system that replicates data: 1. If a partition (P) is detected,
Page 29: Bernard Ourghanlian @Ourghanlian CTO & CSO Microsoft France · Le théorème PACELC (Abadi, 2010, formalisé en 2012) In a system that replicates data: 1. If a partition (P) is detected,
Page 30: Bernard Ourghanlian @Ourghanlian CTO & CSO Microsoft France · Le théorème PACELC (Abadi, 2010, formalisé en 2012) In a system that replicates data: 1. If a partition (P) is detected,
Page 31: Bernard Ourghanlian @Ourghanlian CTO & CSO Microsoft France · Le théorème PACELC (Abadi, 2010, formalisé en 2012) In a system that replicates data: 1. If a partition (P) is detected,
Page 32: Bernard Ourghanlian @Ourghanlian CTO & CSO Microsoft France · Le théorème PACELC (Abadi, 2010, formalisé en 2012) In a system that replicates data: 1. If a partition (P) is detected,

https://github.com/Azure/azure-cosmos-tla

Page 33: Bernard Ourghanlian @Ourghanlian CTO & CSO Microsoft France · Le théorème PACELC (Abadi, 2010, formalisé en 2012) In a system that replicates data: 1. If a partition (P) is detected,
Page 34: Bernard Ourghanlian @Ourghanlian CTO & CSO Microsoft France · Le théorème PACELC (Abadi, 2010, formalisé en 2012) In a system that replicates data: 1. If a partition (P) is detected,

Strong Bounded-staleness Session Consistent prefix Eventual

Cinq modèles de cohérence bien définis

Annulable sur la base de chaque requête

Fournit le contrôle du compromis entre performance et cohérence,

soutenus par des SLAs complets

Un modèle de programmation intuitif offrant faible latence et haute

disponibilité pour vos applications à l’échelle de la planète

COMPROMIS CLAIRS

• Latence

• Disponibilité

• Débit

Page 35: Bernard Ourghanlian @Ourghanlian CTO & CSO Microsoft France · Le théorème PACELC (Abadi, 2010, formalisé en 2012) In a system that replicates data: 1. If a partition (P) is detected,

Niveau de coherence Garanties

Strong Linearizability (once operation is complete, it will be visible to all)

Bounded Staleness Consistent Prefix.

Reads lag behind writes by at most k prefixes or t interval

Similar properties to strong consistency (except within staleness window), while

preserving 99.99% availability and low latency.

Session Consistent Prefix.

Within a session: monotonic reads, monotonic writes, read-your-writes, write-

follows-reads

Predictable consistency for a session, high read throughput + low latency

Consistent Prefix Reads will never see out of order writes (no gaps).

Eventual Potential for out of order reads. Lowest cost for reads of all consistency levels.

Page 36: Bernard Ourghanlian @Ourghanlian CTO & CSO Microsoft France · Le théorème PACELC (Abadi, 2010, formalisé en 2012) In a system that replicates data: 1. If a partition (P) is detected,

Distribution globale à

partir de zéro

Passage à l’échelle

sans limite

Latence extrêmement

basse

Niveaux de cohérence

multiples

Modèle ARS (Atom Record

Sequence

SLAs complets

A l’échelle de la

planète

Multi-Model

Multi-API

Charges de travail

polyvalentesCharges de travail

opérationnelles

Charges de

travail

analytique

Clé-Valeur Tableau GraphDocuments

Azure Cosmos DB

Relationelle

ANSI SQL

Page 37: Bernard Ourghanlian @Ourghanlian CTO & CSO Microsoft France · Le théorème PACELC (Abadi, 2010, formalisé en 2012) In a system that replicates data: 1. If a partition (P) is detected,
Page 38: Bernard Ourghanlian @Ourghanlian CTO & CSO Microsoft France · Le théorème PACELC (Abadi, 2010, formalisé en 2012) In a system that replicates data: 1. If a partition (P) is detected,

Quelques clients qui utilisent déjà Cosmos DB aujourd’hui

Page 39: Bernard Ourghanlian @Ourghanlian CTO & CSO Microsoft France · Le théorème PACELC (Abadi, 2010, formalisé en 2012) In a system that replicates data: 1. If a partition (P) is detected,

Données distribuées et disponibles globalement

Page 40: Bernard Ourghanlian @Ourghanlian CTO & CSO Microsoft France · Le théorème PACELC (Abadi, 2010, formalisé en 2012) In a system that replicates data: 1. If a partition (P) is detected,

Constuire des experiences clients temps reel

Online Recommendations Service

HOT path

Offline Recommendations Engine

COLD path

Page 41: Bernard Ourghanlian @Ourghanlian CTO & CSO Microsoft France · Le théorème PACELC (Abadi, 2010, formalisé en 2012) In a system that replicates data: 1. If a partition (P) is detected,

Idéal pour le gaming et l’e-commerce

Page 42: Bernard Ourghanlian @Ourghanlian CTO & CSO Microsoft France · Le théorème PACELC (Abadi, 2010, formalisé en 2012) In a system that replicates data: 1. If a partition (P) is detected,