SlideShare une entreprise Scribd logo
1  sur  29
Télécharger pour lire hors ligne
Redis Cluster
Come funziona, come fallisce.
Cos’e’ la performance?
• Bassa latenza.
• IOPS.
• Qualita’ delle operazioni.
Go Cluster
• Redis Cluster doveva somigliare a Redis.
• Anche se bisogna scendere a compromessi.
• CAP? Fare il merge dei valori? Mirare alla strong
consistency? Come replicare i dati?
I sistemi CP
Client S1
S2
S3
S4
CAP: paghi la consistenza con le performance.
I sistemi CP
Client S1
S2
S3
S4
Risposta dopo ACK della maggioranza.
Non e’ cosi’ semplice.
S1 S2 S3
Disk Disk Disk
Il disco di ogni nodo fa parte del nostro sistema
distribuito in ogni Modello di Sistema sano.
I sistemi AP
Client
S1
S2
Consistenza eventuale = Merging.
Client
A = {1,2,3,8,12,13,14}
A = {2,3,8,11,12,1}
Altre consistenze…
• La “C” di CAP e’ una consistenza “stretta”.
• Ma non e’ l’unica possibile.
• La consistenza e’ in realta’ il contratto tra il
database e il client…
Redis Cluster
Client
A,B,C
A,B,C
Partizionamento e Replicazione (asincrona).
A,B,C
D,E,F
D,E,F
D,E,F
Replicazione asincrona
Client A,B,C
A,B,C
A,B,C
A,B,C
A,B,C
A,B,C
ACK asincrono
Full Mesh
A,B,C A,B,C
D,E,F D,E,F
• Heartbeats.
• Gossip.
• Consenso per
failover.
• Propagazione
configurazione.
Proxyless + Redirezioni
A,B,C D,E,F G,H,I L,M,N O,P,Q R,S,T
Client Client
A? D?
Failure detection
• Utilizza il gossip per arrivare ad un consenso
“informale”.
• Trigger per il failover (che invece usa un consenso
forte).
• Stati fondamentali: PFAIL -> FAIL
Gestire i metadata
• Dopo il fallimento, segue il failover.
• Il cluster necessita di una visione coerente.
• Chi serve questo slot ora?
• Cosa accade durante le partizioni?
Raft e il failover
• Questi problemi sono risolti usando un “pezzo” di
Raft.
• Raft e’ un algoritmo distribuito del consenso, come
Paxos, ma fatto di parti separate e chiare.
• Il paper originale di Raft e’ gia’ una pietra miliare.
• Ma tutto Raft e’ troppo per Redis Cluster…
Failover: slave vincente
Failed
Slave
Slave
Slave
Master
Master
Master
Epoch = Epoch+1!
(tempo logico)
Vota per me!
Troppo facile?
• Perche’ non abbiamo bisogno di usare Raft
completo?
• L’essenza e’, possiamo rimpiazzare tutto lo “stato”
per uno slot con un solo messaggio, e il nuovo
stato non dipende da quello vecchio.
• Lo stesso algoritmo e’ stato applicato a Sentinel v2
con buoni risultati.
Propagazione
• Dopo il failover la configurazione viene spedita a
tutti i nodi.
• Se ci sono partizioni non importa perche’ viene
rispedita per sempre a tutti i nodi non aggiornati.
• Quella con epoch maggiore vince sempre.
Failure mode… #1
Client A,B,C
A,B,C
A,B,C
Failed
A,B,C
A,B,C
Scrittura!
persa…
Failure mode #2
Client
A,B,C
A,B,C
D,E,F
G,H,I
Minoranza Maggioranza
Limitare divergenze
Client
A,B,C
D,E,F
G,H,I
Minoranza Maggioranza
After node-timeot
Operazioni multi-chiave
!
• Hey hashtags!
• {user:1000}.following {user:1000}.followers.
• Availability compromessa, ma nessun scambio dati
tra nodi.
Operazioni multi-chiave
(availability)
!
• Operazioni a chiave singola: sempre disponibili.
• Operazioni multi-chiave, disponibili se:
• Il custer e’ stabile (nessun resharding manuale).
• Il nodo contiene tutte le chiavi della query.
• Altrimenti -TRYAGAIN
{User:1}.key_A {User:2}.Key_B
{User:1}.key_A
{User:1}.Key_B
{User:1}.key_A
{User:1}.Key_B
SUNION key_A key_B!
-TRYAGAIN
SUNION key_A key_B!
… output …
SUNION key_A key_B!
… output …
Persistenza
• Il concetto di persistenza “Point in Time” non esiste
nel cluster globalmente, ma solo per hash slot.
• Anche le transazioni e le operazioni multi-chiave
sono per hash slot.
• Con il Redis Cluster e’ opportuno usare AOF e non
RDB (ma i due stanno per convergere).
Librerie per i client
• Redis-rb-cluster e’ stato rilasciato come esempio di
client minimo accettabile.
• Jedis, Predis, StackExchange Redis, hanno
aggiunto supporto per Redis Cluster nelle
settimane scorse.
Amministrazione
• HA come conseguenza di usare Redis Cluster.
• redis-trib: create, fix, reshard, …!
• Nuovi strumenti di visualizzazione necessari.
Rilascio
• Siamo alla beta-2
• Ogni mese una nuova beta
• In un paio di mesi: Release Candidate
• RC usabile che diventa “stable” in base ad un
processo empirico.
Migrazione
• Da singolo master a Redis Cluster è immediato.
• Da sharding pre-esistente ci saranno due diversi
modi.
• Non è necessario ad oggi fare lo sharding usando
lo stesso algoritmo di Redis Cluster.
• Problema: op multi-chiave senza hash tag.
• Problema 2: op multi-chiave mission critical.

Contenu connexe

Similaire à Redis Cluster by S. Sanfilippo

Presentazione mongo torino
Presentazione mongo torinoPresentazione mongo torino
Presentazione mongo torino
CSP Scarl
 
Infinispan codemotion - Codemotion Rome 2015
Infinispan codemotion - Codemotion Rome 2015Infinispan codemotion - Codemotion Rome 2015
Infinispan codemotion - Codemotion Rome 2015
Codemotion
 
Presentazione Nuvola Vertica Full New1
Presentazione Nuvola Vertica Full New1Presentazione Nuvola Vertica Full New1
Presentazione Nuvola Vertica Full New1
guest5c2d35b
 
Presentazione Nuvola Vertica Full
Presentazione Nuvola Vertica FullPresentazione Nuvola Vertica Full
Presentazione Nuvola Vertica Full
Alberto.F
 
Presentazione Nuvola Vertica F
Presentazione Nuvola Vertica FPresentazione Nuvola Vertica F
Presentazione Nuvola Vertica F
Alberto.F
 
Presentazione Nuvola Vertica Full New1
Presentazione Nuvola Vertica Full New1Presentazione Nuvola Vertica Full New1
Presentazione Nuvola Vertica Full New1
Alberto.F
 
Presentazione Nuvola Vertica Full New1
Presentazione Nuvola Vertica Full New1Presentazione Nuvola Vertica Full New1
Presentazione Nuvola Vertica Full New1
Alberto.F
 
Presentazione Nuvola Vertica Full New
Presentazione Nuvola Vertica Full NewPresentazione Nuvola Vertica Full New
Presentazione Nuvola Vertica Full New
Alberto.F
 

Similaire à Redis Cluster by S. Sanfilippo (20)

Polyglot Persistance con PostgreSQL, CouchDB, MongoDB, Redis e OrientDB
Polyglot Persistance con PostgreSQL, CouchDB, MongoDB, Redis e OrientDBPolyglot Persistance con PostgreSQL, CouchDB, MongoDB, Redis e OrientDB
Polyglot Persistance con PostgreSQL, CouchDB, MongoDB, Redis e OrientDB
 
Data grid
Data gridData grid
Data grid
 
Presentazione mongo torino
Presentazione mongo torinoPresentazione mongo torino
Presentazione mongo torino
 
MySQL Tech Tour 2015 - Soluzioni di alta disponibilità con MySQL
MySQL Tech Tour 2015 - Soluzioni di alta disponibilità con MySQLMySQL Tech Tour 2015 - Soluzioni di alta disponibilità con MySQL
MySQL Tech Tour 2015 - Soluzioni di alta disponibilità con MySQL
 
CCI2018 - Iperconvergenza con Windows Server
CCI2018 - Iperconvergenza con Windows ServerCCI2018 - Iperconvergenza con Windows Server
CCI2018 - Iperconvergenza con Windows Server
 
Infinispan
InfinispanInfinispan
Infinispan
 
May 2010 - Infinispan
May 2010 - InfinispanMay 2010 - Infinispan
May 2010 - Infinispan
 
Infinispan codemotion - Codemotion Rome 2015
Infinispan codemotion - Codemotion Rome 2015Infinispan codemotion - Codemotion Rome 2015
Infinispan codemotion - Codemotion Rome 2015
 
Thread
ThreadThread
Thread
 
JBoss Data Grid Tech Lab
JBoss Data Grid Tech LabJBoss Data Grid Tech Lab
JBoss Data Grid Tech Lab
 
Lezioni 2009
Lezioni 2009Lezioni 2009
Lezioni 2009
 
Thread
ThreadThread
Thread
 
Presentazione Nuvola Vertica Full New1
Presentazione Nuvola Vertica Full New1Presentazione Nuvola Vertica Full New1
Presentazione Nuvola Vertica Full New1
 
Presentazione Nuvola Vertica Full
Presentazione Nuvola Vertica FullPresentazione Nuvola Vertica Full
Presentazione Nuvola Vertica Full
 
Presentazione Nuvola Vertica F
Presentazione Nuvola Vertica FPresentazione Nuvola Vertica F
Presentazione Nuvola Vertica F
 
Presentazione Nuvola Vertica Full New1
Presentazione Nuvola Vertica Full New1Presentazione Nuvola Vertica Full New1
Presentazione Nuvola Vertica Full New1
 
Presentazione Nuvola Vertica Full New1
Presentazione Nuvola Vertica Full New1Presentazione Nuvola Vertica Full New1
Presentazione Nuvola Vertica Full New1
 
Presentazione Nuvola Vertica Full New
Presentazione Nuvola Vertica Full NewPresentazione Nuvola Vertica Full New
Presentazione Nuvola Vertica Full New
 
Thanatos - Parallel & Distributed Computing
Thanatos -  Parallel & Distributed ComputingThanatos -  Parallel & Distributed Computing
Thanatos - Parallel & Distributed Computing
 
Thanatos
ThanatosThanatos
Thanatos
 

Plus de Corley S.r.l.

Plus de Corley S.r.l. (20)

Aws rekognition - riconoscimento facciale
Aws rekognition  - riconoscimento faccialeAws rekognition  - riconoscimento facciale
Aws rekognition - riconoscimento facciale
 
AWSome day 2018 - scalability and cost optimization with container services
AWSome day 2018 - scalability and cost optimization with container servicesAWSome day 2018 - scalability and cost optimization with container services
AWSome day 2018 - scalability and cost optimization with container services
 
AWSome day 2018 - API serverless with aws
AWSome day 2018  - API serverless with awsAWSome day 2018  - API serverless with aws
AWSome day 2018 - API serverless with aws
 
AWSome day 2018 - database in cloud
AWSome day 2018 -  database in cloudAWSome day 2018 -  database in cloud
AWSome day 2018 - database in cloud
 
Trace your micro-services oriented application with Zipkin and OpenTracing
Trace your micro-services oriented application with Zipkin and OpenTracing Trace your micro-services oriented application with Zipkin and OpenTracing
Trace your micro-services oriented application with Zipkin and OpenTracing
 
Apiconf - The perfect REST solution
Apiconf - The perfect REST solutionApiconf - The perfect REST solution
Apiconf - The perfect REST solution
 
Apiconf - Doc Driven Development
Apiconf - Doc Driven DevelopmentApiconf - Doc Driven Development
Apiconf - Doc Driven Development
 
Authentication and authorization in res tful infrastructures
Authentication and authorization in res tful infrastructuresAuthentication and authorization in res tful infrastructures
Authentication and authorization in res tful infrastructures
 
Flexibility and scalability of costs in serverless infrastructures
Flexibility and scalability of costs in serverless infrastructuresFlexibility and scalability of costs in serverless infrastructures
Flexibility and scalability of costs in serverless infrastructures
 
CloudConf2017 - Deploy, Scale & Coordinate a microservice oriented application
CloudConf2017 - Deploy, Scale & Coordinate a microservice oriented applicationCloudConf2017 - Deploy, Scale & Coordinate a microservice oriented application
CloudConf2017 - Deploy, Scale & Coordinate a microservice oriented application
 
React vs Angular2
React vs Angular2React vs Angular2
React vs Angular2
 
A single language for backend and frontend from AngularJS to cloud with Clau...
A single language for backend and frontend  from AngularJS to cloud with Clau...A single language for backend and frontend  from AngularJS to cloud with Clau...
A single language for backend and frontend from AngularJS to cloud with Clau...
 
AngularJS: Service, factory & provider
AngularJS: Service, factory & providerAngularJS: Service, factory & provider
AngularJS: Service, factory & provider
 
The advantage of developing with TypeScript
The advantage of developing with TypeScript The advantage of developing with TypeScript
The advantage of developing with TypeScript
 
Angular coding: from project management to web and mobile deploy
Angular coding: from project management to web and mobile deployAngular coding: from project management to web and mobile deploy
Angular coding: from project management to web and mobile deploy
 
Corley cloud angular in cloud
Corley cloud   angular in cloudCorley cloud   angular in cloud
Corley cloud angular in cloud
 
Measure your app internals with InfluxDB and Symfony2
Measure your app internals with InfluxDB and Symfony2Measure your app internals with InfluxDB and Symfony2
Measure your app internals with InfluxDB and Symfony2
 
Read Twitter Stream and Tweet back pictures with Raspberry Pi & AWS Lambda
Read Twitter Stream and Tweet back pictures with Raspberry Pi & AWS LambdaRead Twitter Stream and Tweet back pictures with Raspberry Pi & AWS Lambda
Read Twitter Stream and Tweet back pictures with Raspberry Pi & AWS Lambda
 
Deploy and Scale your PHP App with AWS ElasticBeanstalk and Docker- PHPTour L...
Deploy and Scale your PHP App with AWS ElasticBeanstalk and Docker- PHPTour L...Deploy and Scale your PHP App with AWS ElasticBeanstalk and Docker- PHPTour L...
Deploy and Scale your PHP App with AWS ElasticBeanstalk and Docker- PHPTour L...
 
Middleware PHP - A simple micro-framework
Middleware PHP - A simple micro-frameworkMiddleware PHP - A simple micro-framework
Middleware PHP - A simple micro-framework
 

Redis Cluster by S. Sanfilippo