Top Banner
Concurrent Programming Using The Disruptor Trisha Gee, Developer at LMAX @trisha_gee mechanitis.blogspot.com Tuesday, 9 October 12
48

Introduction to the Disruptor

May 17, 2015

Download

Documents

Trisha Gee

Very basic overview of the Disruptor
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Introduction to the Disruptor

Concurrent Programming Using The Disruptor

Trisha Gee, Developer at LMAX@trisha_gee

mechanitis.blogspot.com

Tuesday, 9 October 12

Page 2: Introduction to the Disruptor

The Disruptor?

Tuesday, 9 October 12

Page 3: Introduction to the Disruptor

What is it?

• Data structure and work flow with no contention.

• Very fast message passing.

• Allows you to go truly parallel.

Tuesday, 9 October 12

Page 4: Introduction to the Disruptor

The Magic RingBuffer

Tuesday, 9 October 12

Page 5: Introduction to the Disruptor

The Magic RingBuffer

Tuesday, 9 October 12

Page 6: Introduction to the Disruptor

The Magic RingBuffer

Tuesday, 9 October 12

Page 7: Introduction to the Disruptor

The Magic RingBuffer

Tuesday, 9 October 12

Page 8: Introduction to the Disruptor

The Magic RingBuffer

Tuesday, 9 October 12

Page 9: Introduction to the Disruptor

The Magic RingBuffer

Tuesday, 9 October 12

Page 10: Introduction to the Disruptor

The Magic RingBuffer

Tuesday, 9 October 12

Page 11: Introduction to the Disruptor

The Events are Buckets

Tuesday, 9 October 12

Page 12: Introduction to the Disruptor

I’ve got a RingBuffer!

• Erm.... how do I poke things into it?

Tuesday, 9 October 12

Page 13: Introduction to the Disruptor

The Publisher

Tuesday, 9 October 12

Page 14: Introduction to the Disruptor

Tuesday, 9 October 12

Page 15: Introduction to the Disruptor

Tuesday, 9 October 12

Page 16: Introduction to the Disruptor

Tuesday, 9 October 12

Page 17: Introduction to the Disruptor

Tuesday, 9 October 12

Page 18: Introduction to the Disruptor

Tuesday, 9 October 12

Page 19: Introduction to the Disruptor

Tuesday, 9 October 12

Page 20: Introduction to the Disruptor

...so now I want to read

• The Disruptor provides nice batching behaviour for free

Tuesday, 9 October 12

Page 21: Introduction to the Disruptor

BatchEventProcessor

Tuesday, 9 October 12

Page 22: Introduction to the Disruptor

Tuesday, 9 October 12

Page 23: Introduction to the Disruptor

Tuesday, 9 October 12

Page 24: Introduction to the Disruptor

Tuesday, 9 October 12

Page 25: Introduction to the Disruptor

Tuesday, 9 October 12

Page 26: Introduction to the Disruptor

Tuesday, 9 October 12

Page 27: Introduction to the Disruptor

Tuesday, 9 October 12

Page 28: Introduction to the Disruptor

Tuesday, 9 October 12

Page 29: Introduction to the Disruptor

Tuesday, 9 October 12

Page 30: Introduction to the Disruptor

Tuesday, 9 October 12

Page 31: Introduction to the Disruptor

Tuesday, 9 October 12

Page 32: Introduction to the Disruptor

Tuesday, 9 October 12

Page 33: Introduction to the Disruptor

Tuesday, 9 October 12

Page 34: Introduction to the Disruptor

Tuesday, 9 October 12

Page 35: Introduction to the Disruptor

Tuesday, 9 October 12

Page 36: Introduction to the Disruptor

Shiny. So what?

Tuesday, 9 October 12

Page 37: Introduction to the Disruptor

Complex Workflows

Tuesday, 9 October 12

Page 38: Introduction to the Disruptor

...and in the Disruptor?

Tuesday, 9 October 12

Page 39: Introduction to the Disruptor

Let’s go parallel

Tuesday, 9 October 12

Page 40: Introduction to the Disruptor

Caveats

• Your ring buffer needs to be bigger than 12

• Event handlers are on separate threads

• Mileage May Vary - always performance test

Tuesday, 9 October 12

Page 41: Introduction to the Disruptor

You get...

• A framework the encourages you to model your domain

• The ability to run in parallel but single-threaded

• Nice, simple Java

• Reliable ordering

• ...and it can be very fast

Tuesday, 9 October 12

Page 42: Introduction to the Disruptor

Is that it?

• Wait strategies

• Batch publishing

• Multiple publishers

• The Wizard

• You don’t even need a RingBuffer...

Tuesday, 9 October 12

Page 43: Introduction to the Disruptor

More Information

• Github:github.com/LMAX-Exchange/disruptor

• Google Group

• Blogs

Tuesday, 9 October 12

Page 44: Introduction to the Disruptor

Q&A

Tuesday, 9 October 12

Page 45: Introduction to the Disruptor

WorkerPool

Tuesday, 9 October 12

Page 46: Introduction to the Disruptor

AggregateEventHandler

Tuesday, 9 October 12

Page 47: Introduction to the Disruptor

WaitStrategies

• BlockingWaitStrategy

• BusySpinWaitStrategy

• SleepingWaitStrategy

• YieldingWaitStrategy

Tuesday, 9 October 12

Page 48: Introduction to the Disruptor

ClaimStrategies

• SingleThreadedClaimStrategy

• MultiThreadedClaimStrategy

• MultiThreadedLowContentionClaimStrategy

Tuesday, 9 October 12