Your SlideShare is downloading. ×
0
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Concurrent Programming Using The Disruptor - Copenhagen
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Concurrent Programming Using The Disruptor - Copenhagen

5,640

Published on

The version of my Disruptor talk given at GOTO Copenhagen

The version of my Disruptor talk given at GOTO Copenhagen

Published in: Technology
1 Comment
11 Likes
Statistics
Notes
No Downloads
Views
Total Views
5,640
On Slideshare
0
From Embeds
0
Number of Embeds
20
Actions
Shares
0
Downloads
173
Comments
1
Likes
11
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Concurrent Programming Using The Disruptor Trisha Gee LMAXWednesday, 23 May 12
  • 2. Concurrent Programming Using The Disruptor Trisha Gee, Developer at LMAX @trisha_gee mechanitis.blogspot.comWednesday, 23 May 12
  • 3. The Disruptor?Wednesday, 23 May 12
  • 4. What I’m covering • Overview of the Disruptor • Create your own! • Turn it up to Eleven • Q&AWednesday, 23 May 12
  • 5. What is it? • Data structure and work flow with no contention. • Very fast message passing. • Allows you to go truly parallel.Wednesday, 23 May 12
  • 6. So...?Wednesday, 23 May 12
  • 7. The Magic RingBufferWednesday, 23 May 12
  • 8. The Magic RingBufferWednesday, 23 May 12
  • 9. The Magic RingBufferWednesday, 23 May 12
  • 10. The Magic RingBufferWednesday, 23 May 12
  • 11. The Magic RingBufferWednesday, 23 May 12
  • 12. The Magic RingBufferWednesday, 23 May 12
  • 13. The Magic RingBufferWednesday, 23 May 12
  • 14. Creating a RingBuffer final RingBuffer<SimpleEvent> ringBuffer = new RingBuffer<SimpleEvent>(SimpleEvent.EVENT_FACTORY, RING_BUFFER_SIZE);Wednesday, 23 May 12
  • 15. The Events are BucketsWednesday, 23 May 12
  • 16. Great! I want one! public class SimpleEvent { public static final EventFactory<SimpleEvent> EVENT_FACTORY = new SimpleEventFactory(); private volatile String value; private static class SimpleEventFactory implements EventFactory<SimpleEvent> { @Override public SimpleEvent newInstance() { return new SimpleEvent(); } } }Wednesday, 23 May 12
  • 17. I’ve got a RingBuffer! • Erm.... how do I poke things into it?Wednesday, 23 May 12
  • 18. The PublisherWednesday, 23 May 12
  • 19. Wednesday, 23 May 12
  • 20. Wednesday, 23 May 12
  • 21. Wednesday, 23 May 12
  • 22. Wednesday, 23 May 12
  • 23. Wednesday, 23 May 12
  • 24. Wednesday, 23 May 12
  • 25. What do I do? public class SimpleEventTranslator implements EventTranslator<SimpleEvent>SimpleEventTranslator translator = new SimpleEventTranslator();EventPublisher<SimpleEvent> publisher = new EventPublisher<SimpleEvent>(ringBuffer);// poke your translator here// ...and when you’re done...publisher.publishEvent(translator);Wednesday, 23 May 12
  • 26. ...so now I want to read • The Disruptor provides nice batching behaviour for freeWednesday, 23 May 12
  • 27. Wednesday, 23 May 12
  • 28. Wednesday, 23 May 12
  • 29. Wednesday, 23 May 12
  • 30. Wednesday, 23 May 12
  • 31. Wednesday, 23 May 12
  • 32. Wednesday, 23 May 12
  • 33. Wednesday, 23 May 12
  • 34. Wednesday, 23 May 12
  • 35. Wednesday, 23 May 12
  • 36. Wednesday, 23 May 12
  • 37. Wednesday, 23 May 12
  • 38. Wednesday, 23 May 12
  • 39. Wednesday, 23 May 12
  • 40. Wednesday, 23 May 12
  • 41. Wednesday, 23 May 12
  • 42. ...and all you need is... public class SimpleEventHandler implements EventHandler<SimpleEvent> { @Override public void onEvent(final SimpleEvent event, final long sequence, final boolean endOfBatch) throws Exception { // do stuff } }Wednesday, 23 May 12
  • 43. Shiny. So what?Wednesday, 23 May 12
  • 44. Let’s go parallelWednesday, 23 May 12
  • 45. And now for something different...Wednesday, 23 May 12
  • 46. Remember Henry Ford?Wednesday, 23 May 12
  • 47. Wednesday, 23 May 12
  • 48. Wednesday, 23 May 12
  • 49. Wednesday, 23 May 12
  • 50. Wednesday, 23 May 12
  • 51. Wednesday, 23 May 12
  • 52. Wednesday, 23 May 12
  • 53. Wednesday, 23 May 12
  • 54. Complex workflow...Wednesday, 23 May 12
  • 55. What on Earth has this got to do with RingBuffers?!Wednesday, 23 May 12
  • 56. Wednesday, 23 May 12
  • 57. Wednesday, 23 May 12
  • 58. Wednesday, 23 May 12
  • 59. Wednesday, 23 May 12
  • 60. Wednesday, 23 May 12
  • 61. Wednesday, 23 May 12
  • 62. Wednesday, 23 May 12
  • 63. Wednesday, 23 May 12
  • 64. Wednesday, 23 May 12
  • 65. Wednesday, 23 May 12
  • 66. Wednesday, 23 May 12
  • 67. Wednesday, 23 May 12
  • 68. Wednesday, 23 May 12
  • 69. Wednesday, 23 May 12
  • 70. Wednesday, 23 May 12
  • 71. Wednesday, 23 May 12
  • 72. Wednesday, 23 May 12
  • 73. Wednesday, 23 May 12
  • 74. Wednesday, 23 May 12
  • 75. Wednesday, 23 May 12
  • 76. Wednesday, 23 May 12
  • 77. Wednesday, 23 May 12
  • 78. Wednesday, 23 May 12
  • 79. Wednesday, 23 May 12
  • 80. Wednesday, 23 May 12
  • 81. Wednesday, 23 May 12
  • 82. Wednesday, 23 May 12
  • 83. Wednesday, 23 May 12
  • 84. Wednesday, 23 May 12
  • 85. Wednesday, 23 May 12
  • 86. Wednesday, 23 May 12
  • 87. Wednesday, 23 May 12
  • 88. Wednesday, 23 May 12
  • 89. Wednesday, 23 May 12
  • 90. Wednesday, 23 May 12
  • 91. Wednesday, 23 May 12
  • 92. Wednesday, 23 May 12
  • 93. Don’t wrap the buffer! ringBuffer.setGatingSequences(finalEventProcessor.getSequence());Wednesday, 23 May 12
  • 94. CaveatsWednesday, 23 May 12
  • 95. Is that it? • Wait and claim strategies • Batch publishing • Multiple publishers • Different EventHandlers • The Wizard • You don’t even need a RingBuffer...Wednesday, 23 May 12
  • 96. You get... • A framework the encourages you to model your domain • The ability to run in parallel but single- threaded • Reliable ordering • ...and it can be very fastWednesday, 23 May 12
  • 97. More Information • Google Code Site, including Wiki http://code.google.com/p/disruptor/ • Blogs, e.g. mine: mechanitis.blogspot.com • Presentations • Google GroupWednesday, 23 May 12
  • 98. Q&AWednesday, 23 May 12
  • 99. WorkerPoolWednesday, 23 May 12
  • 100. AggregateEventHandlerWednesday, 23 May 12
  • 101. WaitStrategies • BlockingWaitStrategy • BusySpinWaitStrategy • SleepingWaitStrategy • YieldingWaitStrategyWednesday, 23 May 12
  • 102. ClaimStrategies • SingleThreadedClaimStrategy • MultiThreadedClaimStrategy • MultiThreadedLowContentionClaimStrategyWednesday, 23 May 12

×