SlideShare une entreprise Scribd logo
1  sur  27
Télécharger pour lire hors ligne
java.util.concurrent
for distributed coordination
Devoxx Ukraine 2019
Ensar Basri Kahveci
Distributed Systems Engineer @ Hazelcast
@ metanet
@metanet
Hazelcast
The leading open source Java IMDG
Distributed Java collections, concurrency primitives, messaging
Caching, application scaling, distributed coordination 🎉
Hazelcast Cloud
https://hazelcast.cloud
#devoxxua2019
@metanet
Agenda
What is distributed coordination?
How distributed coordination APIs evolved over time?
Why to use java.util.concurrent.*
Demo on Hazelcast IMDG 3.12
#devoxxua2019
#DevoxxUA
@metanet
Distributed Coordination
Leader election
Synchronization
Service discovery
Configuration management for microservices
#devoxxua2019
@metanet
Challenges
Concurrency problems
Partial failures in distributed systems
Consistency issues
#devoxxua2019
DO IT
YOURSELF
@metanet
Consensus algorithms under the hood
CP with respect to CAP
Deployed as a central service
APIs for coordination tasks
Distributed Coordination Systems
#devoxxua2019
@metanet
Distributed Coordination Systems
Google Chubby (Paxos)
Apache ZooKeeper (ZAB)
etcd (Raft)
#devoxxua2019
@metanet
APIs for Coordination: Layer #1
Some form of KV store API
Suitable for configuration management and service discovery
Foundational layer for building higher-level APIs
/services
/payment
/product
/photo
/services
/services/payment
/services/product
/services/product/photo
Chubby & ZooKeeper etcd
#devoxxua2019
@metanet
APIs for Coordination: Layer #2
Chubby: Locking APIs on files
ZooKeeper: Recipes
Algorithms to build high-level primitives on top its FS
“Friends don't let friends write ZK recipes.” Apache Curator Tech Notes #6
etcd: Leader election and distributed lock primitives on top of its KV store
#devoxxua2019
@metanet
Need for High-level APIs
KV-store / low-level file-system API is
easy to misuse,
not suitable for all coordination tasks.
“Consensus in the Cloud: Paxos Systems Demystified”
High-level APIs minimise guesswork and development effort.
java.util.concurrent.* in JDK
#devoxxua2019
@metanet
Distributed Coordination Systems
Google Chubby (Paxos)
Apache ZooKeeper (ZAB)
etcd (Raft)
Hazelcast IMDG 3.12 CP Subsystem (Raft)
#devoxxua2019
@metanet
Hazelcast IMDG 3.12 CP Subsystem
IAtomicReference
Configuration and metadata management for basic use-cases
IAtomicLong, ICountDownLatch, ISemaphore
Distributed synchronization
FencedLock
Distributed locking and leader election
#devoxxua2019
@metanet
Hazelcast IMDG 3.12 CP Subsystem
Well-defined failure semantics
Strong consistency
CP with respect to CAP
DIY-style tested with Jepsen
#devoxxua2019
@metanet
Strong consistency
Handles crashes and network failures.
Operational as long as the majority is up.
Consensus
Node
Count
Majority Degree of
Fault Tolerance
2 2 0
3 2 1
4 3 1
5 3 2
6 4 2
7 4 3
#devoxxua2019
@metanet
Understandability as the primary goal
Runtime concerns (snapshotting, dynamic membership)
Performance optimizations (fast reads, batching)
https://raft.github.io
Why Raft?
#devoxxua2019
@metanet
ENOUGH TALK
LET’S DEMO
@metanet
https://github.com/metanet/juc-talk
DEMO #1: Leader Election
#devoxxua2019
@metanet
CP Sessions
A session starts on the first lock / semaphore request.
Session heartbeats are periodically committed in the background.
If no heartbeat for some time (session TTL), the session is closed.
Auto-release mechanism for FencedLock and ISemaphore
#devoxxua2019
@metanet
CP sessions offer a trade-off between safety and liveness.
#devoxxua2019
@metanet
“How to do distributed locking”
“Distributed locks are dead; long live distributed locks!”
DEMO #2: Fencing-off Stale Lock Holders
#devoxxua2019
@metanet
Replacing crashed CP members to preserve high availability
Demo #3: Handling Server Failures
#devoxxua2019
@metanet
Recap
Avoid writing your own implementations for coordination.
High-level APIs minimise guesswork and development effort.
java.util.concurrent.* FTW!
Operational simplicity matters.
Dynamic clustering
Horizontal scalability
#devoxxua2019
@metanet
Current Status
In Hazelcast 4.0:
CP Subsystem disk persistence
Metrics
In roadmap:
KV Store
Event Listeners
More client languages
#devoxxua2019
@metanet
Resources
https://github.com/metanet/juc-talk (demos)
Hazelcast IMDG Docs
CP Subsystem Code Samples
https://hazelcast.com/blog/author/ensarbasri
Hazelcast IMDG 3.12
#devoxxua2019
Дякую!
Devoxx Ukraine 2019
#DevoxxUA
Ensar Basri Kahveci
Distributed Systems Engineer @ Hazelcast
@ metanet

Contenu connexe

Plus de Ensar Basri Kahveci

Plus de Ensar Basri Kahveci (8)

Distributed Systems Theory for Mere Mortals - Topconf Dusseldorf October 2017
Distributed Systems Theory for Mere Mortals - Topconf Dusseldorf October 2017Distributed Systems Theory for Mere Mortals - Topconf Dusseldorf October 2017
Distributed Systems Theory for Mere Mortals - Topconf Dusseldorf October 2017
 
Distributed Systems Theory for Mere Mortals - GeeCON Krakow May 2017
Distributed Systems Theory for Mere Mortals -  GeeCON Krakow May 2017Distributed Systems Theory for Mere Mortals -  GeeCON Krakow May 2017
Distributed Systems Theory for Mere Mortals - GeeCON Krakow May 2017
 
Replication in the Wild - Warsaw Cloud Native Meetup - May 2017
Replication in the Wild - Warsaw Cloud Native Meetup - May 2017Replication in the Wild - Warsaw Cloud Native Meetup - May 2017
Replication in the Wild - Warsaw Cloud Native Meetup - May 2017
 
Distributed Systems Theory for Mere Mortals - Java Day Istanbul May 2017
Distributed Systems Theory for Mere Mortals - Java Day Istanbul May 2017 Distributed Systems Theory for Mere Mortals - Java Day Istanbul May 2017
Distributed Systems Theory for Mere Mortals - Java Day Istanbul May 2017
 
Client-centric Consistency Models
Client-centric Consistency ModelsClient-centric Consistency Models
Client-centric Consistency Models
 
Replication in the Wild
Replication in the WildReplication in the Wild
Replication in the Wild
 
Distributed Systems Theory for Mere Mortals
Distributed Systems Theory for Mere MortalsDistributed Systems Theory for Mere Mortals
Distributed Systems Theory for Mere Mortals
 
Ankara Jug - Practical Functional Programming with Scala
Ankara Jug - Practical Functional Programming with ScalaAnkara Jug - Practical Functional Programming with Scala
Ankara Jug - Practical Functional Programming with Scala
 

Dernier

CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 

Dernier (20)

Pharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodologyPharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodology
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verifiedSector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
ManageIQ - Sprint 236 Review - Slide Deck
ManageIQ - Sprint 236 Review - Slide DeckManageIQ - Sprint 236 Review - Slide Deck
ManageIQ - Sprint 236 Review - Slide Deck
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
 
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptxBUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
 

java.util.concurrent for Distributed Coordination - Devoxx Ukraine 2019