when aeron met raft
play

When Aeron Met Raft Martin Thompson - @mjpt777 What does Consensus - PowerPoint PPT Presentation

Cluster Consensus When Aeron Met Raft Martin Thompson - @mjpt777 What does Consensus mean? consensus noun \ k n- sen(t)-s s \ : general agreement : unanimity Source: http://www.merriam-webster.com/ consensus noun \ k


  1. Cluster Consensus When Aeron Met Raft Martin Thompson - @mjpt777

  2. What does “Consensus” mean?

  3. con•sen•sus noun \ k ə n- ˈ sen(t)-s ə s \ : general agreement : unanimity Source: http://www.merriam-webster.com/

  4. con•sen•sus noun \ k ə n- ˈ sen(t)-s ə s \ : general agreement : unanimity : the judgment arrived at by most of those concerned Source: http://www.merriam-webster.com/

  5. https://raft.github.io/raft.pdf

  6. https://www.cl.cam.ac.uk/~ms705/pub/papers/2015-osr-raft.pdf

  7. Raft in a Nutshell

  8. Roles Follower Candidate Leader

  9. RPCs 1. RequestVote RPC Invoked by candidates to gather votes 2. AppendEntries RPC Invoked by leader to replicate and heartbeat

  10. Safety Guarantees Election Safety • Leader Append-Only • Log Matching • Leader Completeness • State Machine Safety •

  11. Monotonic Functions

  12. Version all the things!

  13. Clustering Aeron

  14. Is it Guaranteed Delivery™ ???

  15. Wha t is the “Architect” really looking for?

  16. Replicated State Machines => Redundant Deterministic Services

  17. Client Client Client Client Client Service

  18. Client Client Client Client Client Service

  19. Client Client Client Client Client Consensus Consensus Consensus Module Module Module Service Service Service

  20. NIO Pain

  21. FileChannel channel = null; try { channel = FileChannel. open (directory.toPath()); } catch (final IOException ignore) { } if (null != channel) { channel.force(true); }

  22. Directory Sync Files.force(directory.toPath(), true);

  23. Performance

  24. Let’s consider the application of an RPC design approach

  25. Client Client Client Client Client Consensus Consensus Consensus Module Module Module Service Service Service

  26. Should we consider concurrency and parallelism with Replicated State Machines?

  27. “Concurrency is about dealing with lots of things at once. Parallelism is about doing lots of things at once.” – Rob Pike

  28. 1. Parallel is the opposite of Serial 2. Concurrent is the opposite of Sequential 3. Vector is the opposite of Scalar – John Gustafson

  29. Instruction Pipelining Time Fetch

  30. Instruction Pipelining Time Fetch Decode

  31. Instruction Pipelining Time Fetch Decode Execute

  32. Instruction Pipelining Time Fetch Decode Execute Retire

  33. Instruction Pipelining Time Fetch Decode Execute Retire Fetch Decode Execute Retire

  34. Instruction Pipelining Time Fetch Decode Execute Retire Fetch Decode Execute Retire Fetch Decode Execute Retire

  35. Instruction Pipelining Time Fetch Decode Execute Retire Fetch Decode Execute Retire Fetch Decode Execute Retire Fetch Decode Execute Retire

  36. Consensus Pipeline Time Order

  37. Consensus Pipeline Time Order Log

  38. Consensus Pipeline Time Order Log Transmit

  39. Consensus Pipeline Time Order Log Transmit Commit

  40. Consensus Pipeline Time Order Log Transmit Commit Execute

  41. Consensus Pipeline Time Order Log Transmit Commit Execute Order Log Transmit Commit Execute

  42. Consensus Pipeline Time Order Log Transmit Commit Execute Order Log Transmit Commit Execute Order Log Transmit Commit Execute

  43. Client Client Client Client Client Consensus Consensus Consensus Module Module Module Service Service Service

  44. Client Client Client Client Client Consensus Consensus Consensus Module Module Module Service Service Service

  45. NIO Pain

  46. ByteBuffer byte[] copies ByteBuffer byteBuffer = ByteBuffer. allocate (64 * 1024); byteBuffer.putInt(index, value);

  47. ByteBuffer byte[] copies ByteBuffer byteBuffer = ByteBuffer. allocate (64 * 1024); byteBuffer.putBytes(index, bytes);

  48. ByteBuffer byte[] copies ByteBuffer byteBuffer = ByteBuffer. allocate (64 * 1024); byteBuffer.putBytes(index, bytes);

  49. How can Aeron help?

  50. Message Index => Byte Index

  51. Multicast, MDC, and Spy based Messaging

  52. Counters and Bounded Consumption

  53. Binary Protocols & Zero intermediate copies

  54. Batching – Amortising Costs 100% 90% Average overhead 80% 70% per item or operation 60% in batch 50% 40% 30% 20% 10% 0% 0 5 10 15 20

  55. Batching – Amortising Costs 100% 90% System calls • 80% Network round trips • 70% Disk writes • 60% Expensive calculations • 50% 40% 30% 20% 10% 0% 0 5 10 15 20

  56. Interesting Features

  57. Agents and Threads

  58. Timers

  59. Back Pressure and Stashed Work

  60. Replay and Snapshots

  61. Multiple Services on the same stream

  62. Client Client Client Client Client Consensus Consensus Consensus Module Module Module Service Service Service

  63. Client Client Client Client Client Consensus Consensus Consensus Module Module Module Service Service Service Service Service Service Service Service Service

  64. In Closing

  65. NIO Pain

  66. DirectByteBuffer MappedByteBuffer DirectByteBuffer MappedByteBuffer

  67. Questions? https://github.com/real-logic/aeron Twitter: @mjpt777 “A distributed system is one in which the failure of a computer you didn't even know existed can render your own computer unusable.” - Leslie Lamport

Recommend


More recommend