Presentation is loading. Please wait.

Presentation is loading. Please wait.

Clustering and Distributed Data: The Winning Combination?

Similar presentations


Presentation on theme: "Clustering and Distributed Data: The Winning Combination?"— Presentation transcript:

1 Clustering and Distributed Data: The Winning Combination?
Patrick Altaie paltaie

2 About the Author From Moved to (2013) Weird accent Design lead at

3 Which makes SW19 famous for

4 Disclaimer There isn’t one

5 Agenda (all in 45min!) Akka clustering Cluster Singleton
State in an Akka cluster Akka Distributed Data A demo! Agenda (all in 45min!)

6 Akka Clustering Logical grouping for 1-n actor systems
Helps create a truly fault-tolerant application Decentralised Gossip based - cartesian product! Actor systems can be heterogenous! - not all actor systems in a cluster need to be the exact same Manuel Bernhardt's talk: - phi accrual detector - joining, leaving - CRDT

7 But wait... What if I: Have an actor that maintains global state?
Need to bind to a port/have a single entry point? Need to coordinate actions across the cluster system? Like a scheduler maybe?

8 Cluster Singleton! Runs on the oldest node in the cluster
You can create any actor as a cluster singleton Akka ensures only one instance of it runs in the cluster

9 But wait…(again) Data that’s known in node[1-n] won’t be shared with the other nodes! And what if we have a conflict?

10 Akka Distributed Data! Fancy eventually consistent distributed store
You decide the consistency requirement Akka supplies you a Replicator actor: DistributedData.get(context().system()).replicator(); To solve conflict problem, values must be CRDTs Counters, sets, maps, registers. Some supplied: GCounter, PNCounter GSet, ORSet ORMap, PNCounterMap, LWWMap Flag, LWWRegister Know your CRDT lingo!: “G”: Grow “PN”: Positive and Negative “OR”: Observed Remove Set “LWW”: Last Writer Wins “PN”Counter is actually two GCounters (one going up and one going down) You can roll your own data type and implement a merge function

11 An Example Let’s write a TFTP server! A subset of FTP RFC 1350
Lockstep protocol Five message types Requirements: Resilient Distributed Who knew TFTP (1992) was a fast data system that implemented push-pull stream processing Problem: Requested file only shows up in the RRQ!

12 All TFTP Message Types Opcode Description Direction 1
Read Request (RRQ) Client -> Server 2 Write Request (WRQ) 3 0-512B data block (DATA) Server -> Client 4 Acknowledgement of a DATA block (ACK) 5 Bad things! 😱 (ERROR) Both

13 Architecture of a single node

14 Demo time!

15 Pitfalls/downsides Akka Clustering: Split brain
Akka DD: Not blazing fast >50 ms for WriteMajority when >10 nodes in the cluster Want blazing fast? Akka Distributed PubSub! Akka DD: Not for “big data” All entries are held in memory Limit of 100,000 top-level elements Replication via gossip gets slower Resolutions for split brain: Akka split brain resolver Using an external system as an arbiter (e.g. MongoDB odd number of nodes)

16 github.com/paltaie/akka-tftp-server
It’s on GitHub! github.com/paltaie/akka-tftp-server

17 iconsolutions.com/ipf
Shameless plug Live on Earth? We’re hiring! Java devs Architects It’s in Wimbledon Working in payments? Instant payments got you down? iconsolutions.com/ipf

18 Thanks! paltaie.com twitter.com/paltaie github.com/paltaie


Download ppt "Clustering and Distributed Data: The Winning Combination?"

Similar presentations


Ads by Google