SlideShare a Scribd company logo
Replication Distilled:
Hazelcast Deep Dive
Ensar Basri Kahveci
Hazelcast
Hazelcast
▪ The leading open source Java IMDG
▪ Distributed Java collections, concurrency primitives, ...
▪ Distributed computations, messaging, ...
In-Memory Data Grids
▪ Distributed caching
▪ Keeping data in local JVM for fast access & processing
▪ Elasticity, availability, high throughput, and low latency
▪ Multiple copies of data to tolerate failures
Replication
▪ Putting a data set into multiple nodes
▪ Fault tolerance
▪ Latency
▪ Throughput
Challenges
▪ Where to perform reads & writes?
▪ How to keep replicas sync?
▪ How to handle concurrent reads & writes?
▪ How to handle failures?
CAP Principle
▪ Pick two of C, A, and P
▪ CP versus AP
CP
AP
Consistency/Latency Trade-off
Consistency/Latency Trade-off
PACELC Principle
▪ If there is a network partition (P), we have to choose
between availability and consistency (AC).
▪ Else (E), during normal operation, we can choose
between latency and consistency (LC).
Let’s build
the core replication protocol
of Hazelcast
Primary Copy
▪ Operations are sent to primary replicas.
▪ Strong consistency when the primary is reachable.
Partitioning (Sharding)
▪ Partitioning helps to scale primaries.
▪ A primary replica is elected for each partition.
Updating Replicas
Updating Replicas
partition id = hash(serialize(key)) % partition count
Updating Replicas
Updating Replicas
Async Replication
▪ Each replica is updated separately.
▪ High throughput and availability
Anti-Entropy
▪ Backup replicas can fall behind the primary.
▪ Non-sync backups are fixed with an active anti-entropy
mechanism.
Replicas are not sync
▪ The client reads a key from the current primary replica.
Network Partitioning
▪ The client reads the same key.
Split-Brain
▪ Strong consistency is lost.
Resolving the Divergence
▪ Merge policies: higher hits, latest update / access, …
▪ Merging may cause lost updates.
Let’s classify this protocol
with PACELC
Hazelcast is PA/EC
▪ Consistency is usually traded to availability and latency
together.
▪ Hazelcast works in memory and mostly used in a single
computing cluster.
▪ Consistency - latency trade-off is minimal.
▪ PA/EC works fine for distributed caching.
Favoring Latency
(PA/EL)
Scaling Reads
▪ Reads can be served locally from near caches and
backup replicas.
Favoring Consistency
(PC/EC)
Failure Detectors
▪ Local failure detectors rely on timeouts.
▪ Operations are blocked after the cluster size falls below
a threshold.
Failure Detectors
▪ It takes some time to detect an unresponsive node.
▪ Minimizes divergence and maintains the baseline
consistency.
Isolated Failure Detectors
▪ Configure failure detectors independently for data
structures
▪ Phi-Accrual Failure Detector
CP Data Structures
▪ IDGenerator
▪ Distributed impls of java.util.concurrent.*
▪ PA/EC is not the perfect fit for CP data structures.
Flake IDs
▪ Local unique id generation
▪ Nodes get a unique node id during join.
▪ K-ordered IDs
CRDTs
▪ CRDTs: Conflict-free Replicated Data Types
▪ Replicas are updated concurrently without coordination.
▪ Strong eventual consistency
▪ Counters, sets, maps, graphs, ...
PN-Counter
PN-Counter
Sync Replication
▪ Concurrency primitives imply the true CP behavior.
▪ Paxos, Raft, ZAB, VR
▪ Re-implementing Hazelcast concurrency primitives with
Raft
Recap
▪ http://bit.ly/hazelcast-replication-consistency
▪ http://bit.ly/hazelcast-network-partitions
▪ http://dbmsmusings.blogspot.com/2017/10/hazelcast-an
d-mythical-paec-system.html
Thanks!
You can find me at
▪ @metanet
▪ ebkahveci@gmail.com

More Related Content

PDF
Replication Distilled: Hazelcast Deep Dive - Berlin Expert Days 2018
PDF
From AP to CP and Back: The Curious Case of Hazelcast (jdk.io 2018)
PDF
Designing for concurrency and performance
PDF
Distributed Caching Using the JCACHE API and ehcache, Including a Case Study ...
PDF
Web session replication with Hazelcast
PPT
Session Handling Using Memcache
PPTX
StarWind Virtual SAN Overview
ODP
Caching technology comparison
Replication Distilled: Hazelcast Deep Dive - Berlin Expert Days 2018
From AP to CP and Back: The Curious Case of Hazelcast (jdk.io 2018)
Designing for concurrency and performance
Distributed Caching Using the JCACHE API and ehcache, Including a Case Study ...
Web session replication with Hazelcast
Session Handling Using Memcache
StarWind Virtual SAN Overview
Caching technology comparison

What's hot (18)

PDF
StarWind_V_SAN_product_presentation
PDF
Hybrid Storage Pools (Now with the benefit of hindsight!)
PPTX
Varrow madness 2013 virtualizing sql presentation
PPTX
Webinar: StorPool and WHIR - better storage, better business
PPTX
Webinar: Overcoming the Storage Challenges Cassandra and Couchbase Create
PPTX
Vm13 vnx mixed workloads
PPTX
Varrow datacenter storage today and tomorrow
PDF
Cassandra On EC2
PDF
Caching principles-solutions
PDF
Building high traffic http front-ends. theo schlossnagle. зал 1
PDF
Building low latency java applications with ehcache
PDF
Ensuring performance for real time packet processing in open stack white paper
PDF
Optimization_of_Virtual_Machines_for_High_Performance
PDF
BigData as a Platform: Cassandra and Current Trends
PPTX
SM16 - Can i move my stuff to openstack
PPTX
Scalabe MySQL Infrastructure
PPTX
Caching In Java- Best Practises and Pitfalls
PDF
My S Q L Replication Getting The Most From Slaves
StarWind_V_SAN_product_presentation
Hybrid Storage Pools (Now with the benefit of hindsight!)
Varrow madness 2013 virtualizing sql presentation
Webinar: StorPool and WHIR - better storage, better business
Webinar: Overcoming the Storage Challenges Cassandra and Couchbase Create
Vm13 vnx mixed workloads
Varrow datacenter storage today and tomorrow
Cassandra On EC2
Caching principles-solutions
Building high traffic http front-ends. theo schlossnagle. зал 1
Building low latency java applications with ehcache
Ensuring performance for real time packet processing in open stack white paper
Optimization_of_Virtual_Machines_for_High_Performance
BigData as a Platform: Cassandra and Current Trends
SM16 - Can i move my stuff to openstack
Scalabe MySQL Infrastructure
Caching In Java- Best Practises and Pitfalls
My S Q L Replication Getting The Most From Slaves
Ad

Similar to Replication Distilled: Hazelcast Deep Dive @ In-Memory Computing Summit San Francisco 2018 (20)

PDF
Distributed Caching Essential Lessons (Ts 1402)
PDF
Scalability, Availability & Stability Patterns
PPTX
From cache to in-memory data grid. Introduction to Hazelcast.
PPTX
Scylla Summit 2018: Rebuilding the Ceph Distributed Storage Solution with Sea...
PPTX
Jug Lugano - Scale over the limits
PDF
Challenges and Opportunities of Big Data Genomics
PDF
In-memory Data Management Trends & Techniques
PDF
"JBoss clustering solutions Mission Critical Enterprise" by Mircea Markus @ e...
PDF
Tips and Tricks for SAP Sybase IQ
PPTX
CPU Caches
PPTX
How swift is your Swift - SD.pptx
PPTX
HBase Operations and Best Practices
PDF
Cassandra for Sysadmins
ODP
MySQL 5.7 clustering: The developer perspective
PPTX
Application Profiling for Memory and Performance
PDF
Lightweight Grids With Terracotta
PDF
Performance and predictability
PDF
Why new hardware may not make Oracle databases faster
PDF
Spring One 2 GX 2014 - CACHING WITH SPRING: ADVANCED TOPICS AND BEST PRACTICES
PPTX
Scale your Alfresco Solutions
Distributed Caching Essential Lessons (Ts 1402)
Scalability, Availability & Stability Patterns
From cache to in-memory data grid. Introduction to Hazelcast.
Scylla Summit 2018: Rebuilding the Ceph Distributed Storage Solution with Sea...
Jug Lugano - Scale over the limits
Challenges and Opportunities of Big Data Genomics
In-memory Data Management Trends & Techniques
"JBoss clustering solutions Mission Critical Enterprise" by Mircea Markus @ e...
Tips and Tricks for SAP Sybase IQ
CPU Caches
How swift is your Swift - SD.pptx
HBase Operations and Best Practices
Cassandra for Sysadmins
MySQL 5.7 clustering: The developer perspective
Application Profiling for Memory and Performance
Lightweight Grids With Terracotta
Performance and predictability
Why new hardware may not make Oracle databases faster
Spring One 2 GX 2014 - CACHING WITH SPRING: ADVANCED TOPICS AND BEST PRACTICES
Scale your Alfresco Solutions
Ad

More from Ensar Basri Kahveci (13)

PDF
java.util.concurrent for Distributed Coordination - Berlin Expert Days 2019
PDF
java.util.concurrent for Distributed Coordination, Riga DevDays 2019
PDF
java.util.concurrent for Distributed Coordination, GeeCON Krakow 2019
PDF
java.util.concurrent for Distributed Coordination, JEEConf 2019
PDF
Distributed Systems Theory for Mere Mortals - Software Craftsmanship Turkey
PDF
Distributed Systems Theory for Mere Mortals - Topconf Dusseldorf October 2017
PDF
Distributed Systems Theory for Mere Mortals - GeeCON Krakow May 2017
PDF
Replication in the Wild - Warsaw Cloud Native Meetup - May 2017
PDF
Distributed Systems Theory for Mere Mortals - Java Day Istanbul May 2017
PDF
Client-centric Consistency Models
PDF
Replication in the Wild
PDF
Distributed Systems Theory for Mere Mortals
PDF
Ankara Jug - Practical Functional Programming with Scala
java.util.concurrent for Distributed Coordination - Berlin Expert Days 2019
java.util.concurrent for Distributed Coordination, Riga DevDays 2019
java.util.concurrent for Distributed Coordination, GeeCON Krakow 2019
java.util.concurrent for Distributed Coordination, JEEConf 2019
Distributed Systems Theory for Mere Mortals - Software Craftsmanship Turkey
Distributed Systems Theory for Mere Mortals - Topconf Dusseldorf October 2017
Distributed Systems Theory for Mere Mortals - GeeCON Krakow May 2017
Replication in the Wild - Warsaw Cloud Native Meetup - May 2017
Distributed Systems Theory for Mere Mortals - Java Day Istanbul May 2017
Client-centric Consistency Models
Replication in the Wild
Distributed Systems Theory for Mere Mortals
Ankara Jug - Practical Functional Programming with Scala

Recently uploaded (20)

PPT
Mechanical Engineering MATERIALS Selection
PPTX
Internet of Things (IOT) - A guide to understanding
PDF
PREDICTION OF DIABETES FROM ELECTRONIC HEALTH RECORDS
PDF
Human-AI Collaboration: Balancing Agentic AI and Autonomy in Hybrid Systems
PDF
R24 SURVEYING LAB MANUAL for civil enggi
PDF
composite construction of structures.pdf
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
DOCX
573137875-Attendance-Management-System-original
PPTX
Safety Seminar civil to be ensured for safe working.
DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
PDF
Embodied AI: Ushering in the Next Era of Intelligent Systems
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PDF
Model Code of Practice - Construction Work - 21102022 .pdf
PPTX
Sustainable Sites - Green Building Construction
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PPTX
Foundation to blockchain - A guide to Blockchain Tech
PDF
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PPTX
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
PPTX
additive manufacturing of ss316l using mig welding
Mechanical Engineering MATERIALS Selection
Internet of Things (IOT) - A guide to understanding
PREDICTION OF DIABETES FROM ELECTRONIC HEALTH RECORDS
Human-AI Collaboration: Balancing Agentic AI and Autonomy in Hybrid Systems
R24 SURVEYING LAB MANUAL for civil enggi
composite construction of structures.pdf
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
573137875-Attendance-Management-System-original
Safety Seminar civil to be ensured for safe working.
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
Embodied AI: Ushering in the Next Era of Intelligent Systems
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
Model Code of Practice - Construction Work - 21102022 .pdf
Sustainable Sites - Green Building Construction
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
Foundation to blockchain - A guide to Blockchain Tech
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
UNIT-1 - COAL BASED THERMAL POWER PLANTS
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
additive manufacturing of ss316l using mig welding

Replication Distilled: Hazelcast Deep Dive @ In-Memory Computing Summit San Francisco 2018