SlideShare une entreprise Scribd logo
1  sur  97
Concurrent Programming
  Using The Disruptor
    Trisha Gee, Developer at LMAX
               @trisha_gee
           mechanitis.blogspot.com
The Disruptor?
What I’m covering

• Overview of the Disruptor
• Create your own!
• Turn it up to Eleven
• Q&A
What is it?

• Data structure and work flow with no
  contention.
• Very fast message passing.
• Allows you to go truly parallel.
So...?
The Magic RingBuffer
The Magic RingBuffer
The Magic RingBuffer
The Magic RingBuffer
The Magic RingBuffer
The Magic RingBuffer
The Magic RingBuffer
Creating a RingBuffer

final RingBuffer<SimpleEvent> ringBuffer =
    new RingBuffer<SimpleEvent>(SimpleEvent.EVENT_FACTORY,
                                RING_BUFFER_SIZE);
The Events are Buckets
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();
        }
    }
}
I’ve got a RingBuffer!


• Erm.... how do I poke things into it?
The Publisher
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);
...so now I want to read


• The Disruptor provides nice batching
  behaviour for free
...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
    }
}
Shiny. So what?
Let’s go parallel
And now for something
      different...
Remember Henry
    Ford?
Complex workflow...
What on Earth has this
   got to do with
    RingBuffers?!
Don’t wrap the buffer!

ringBuffer.setGatingSequences(finalEventProcessor.getSequence());
Caveats
Is that it?

• Wait and claim strategies
• Multiple publishers
• Different EventHandlers
• The Wizard
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 fast
More Information

• Google Code Site, including Wiki
  http://code.google.com/p/disruptor/
• Blogs, e.g. mine: mechanitis.blogspot.com
• Presentations
• Google Group
Q&A


• We are hiring!
• careers@lmax.com

Contenu connexe

Tendances

Scalable and Available, Patterns for Success
Scalable and Available, Patterns for SuccessScalable and Available, Patterns for Success
Scalable and Available, Patterns for Success
Derek Collison
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to Redis
Dvir Volk
 
Building high performance microservices in finance with Apache Thrift
Building high performance microservices in finance with Apache ThriftBuilding high performance microservices in finance with Apache Thrift
Building high performance microservices in finance with Apache Thrift
RX-M Enterprises LLC
 
Introduction to Storm
Introduction to Storm Introduction to Storm
Introduction to Storm
Chandler Huang
 
HBase and HDFS: Understanding FileSystem Usage in HBase
HBase and HDFS: Understanding FileSystem Usage in HBaseHBase and HDFS: Understanding FileSystem Usage in HBase
HBase and HDFS: Understanding FileSystem Usage in HBase
enissoz
 

Tendances (20)

Low latency in java 8 v5
Low latency in java 8 v5Low latency in java 8 v5
Low latency in java 8 v5
 
Scalable and Available, Patterns for Success
Scalable and Available, Patterns for SuccessScalable and Available, Patterns for Success
Scalable and Available, Patterns for Success
 
From cache to in-memory data grid. Introduction to Hazelcast.
From cache to in-memory data grid. Introduction to Hazelcast.From cache to in-memory data grid. Introduction to Hazelcast.
From cache to in-memory data grid. Introduction to Hazelcast.
 
Stability Patterns for Microservices
Stability Patterns for MicroservicesStability Patterns for Microservices
Stability Patterns for Microservices
 
Producer Performance Tuning for Apache Kafka
Producer Performance Tuning for Apache KafkaProducer Performance Tuning for Apache Kafka
Producer Performance Tuning for Apache Kafka
 
Writing and testing high frequency trading engines in java
Writing and testing high frequency trading engines in javaWriting and testing high frequency trading engines in java
Writing and testing high frequency trading engines in java
 
Scalability, Availability & Stability Patterns
Scalability, Availability & Stability PatternsScalability, Availability & Stability Patterns
Scalability, Availability & Stability Patterns
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to Redis
 
Quarkus k8s
Quarkus   k8sQuarkus   k8s
Quarkus k8s
 
Apache ZooKeeper
Apache ZooKeeperApache ZooKeeper
Apache ZooKeeper
 
SeaweedFS introduction
SeaweedFS introductionSeaweedFS introduction
SeaweedFS introduction
 
High Concurrency Architecture at TIKI
High Concurrency Architecture at TIKIHigh Concurrency Architecture at TIKI
High Concurrency Architecture at TIKI
 
Building high performance microservices in finance with Apache Thrift
Building high performance microservices in finance with Apache ThriftBuilding high performance microservices in finance with Apache Thrift
Building high performance microservices in finance with Apache Thrift
 
Vert.x for Microservices Architecture
Vert.x for Microservices ArchitectureVert.x for Microservices Architecture
Vert.x for Microservices Architecture
 
Grafana optimization for Prometheus
Grafana optimization for PrometheusGrafana optimization for Prometheus
Grafana optimization for Prometheus
 
Kafka: All an engineer needs to know
Kafka: All an engineer needs to knowKafka: All an engineer needs to know
Kafka: All an engineer needs to know
 
Introduction to Apache ZooKeeper
Introduction to Apache ZooKeeperIntroduction to Apache ZooKeeper
Introduction to Apache ZooKeeper
 
Introduction to Storm
Introduction to Storm Introduction to Storm
Introduction to Storm
 
HBase and HDFS: Understanding FileSystem Usage in HBase
HBase and HDFS: Understanding FileSystem Usage in HBaseHBase and HDFS: Understanding FileSystem Usage in HBase
HBase and HDFS: Understanding FileSystem Usage in HBase
 
Twitter의 snowflake 소개 및 활용
Twitter의 snowflake 소개 및 활용Twitter의 snowflake 소개 및 활용
Twitter의 snowflake 소개 및 활용
 

Similaire à Concurrent Programming Using the Disruptor

Fast, concurrent ruby web applications with EventMachine and EM::Synchrony
Fast, concurrent ruby web applications with EventMachine and EM::SynchronyFast, concurrent ruby web applications with EventMachine and EM::Synchrony
Fast, concurrent ruby web applications with EventMachine and EM::Synchrony
Kyle Drake
 
Solving Problems with YUI3: AutoComplete
Solving Problems with YUI3: AutoCompleteSolving Problems with YUI3: AutoComplete
Solving Problems with YUI3: AutoComplete
IsaacSchlueter
 

Similaire à Concurrent Programming Using the Disruptor (20)

JS Event Loop
JS Event LoopJS Event Loop
JS Event Loop
 
Fast, concurrent ruby web applications with EventMachine and EM::Synchrony
Fast, concurrent ruby web applications with EventMachine and EM::SynchronyFast, concurrent ruby web applications with EventMachine and EM::Synchrony
Fast, concurrent ruby web applications with EventMachine and EM::Synchrony
 
Ruby 1.9 Fibers
Ruby 1.9 FibersRuby 1.9 Fibers
Ruby 1.9 Fibers
 
How NOT to write in Node.js
How NOT to write in Node.jsHow NOT to write in Node.js
How NOT to write in Node.js
 
Solving Problems with YUI3: AutoComplete
Solving Problems with YUI3: AutoCompleteSolving Problems with YUI3: AutoComplete
Solving Problems with YUI3: AutoComplete
 
"Leveraging the Event Loop for Blazing-Fast Applications!", Michael Di Prisco
"Leveraging the Event Loop for Blazing-Fast Applications!",  Michael Di Prisco"Leveraging the Event Loop for Blazing-Fast Applications!",  Michael Di Prisco
"Leveraging the Event Loop for Blazing-Fast Applications!", Michael Di Prisco
 
Async programming and python
Async programming and pythonAsync programming and python
Async programming and python
 
Cross-platform logging and analytics
Cross-platform logging and analyticsCross-platform logging and analytics
Cross-platform logging and analytics
 
Playing With Fire - An Introduction to Node.js
Playing With Fire - An Introduction to Node.jsPlaying With Fire - An Introduction to Node.js
Playing With Fire - An Introduction to Node.js
 
What is Node.js
What is Node.jsWhat is Node.js
What is Node.js
 
Performance #6 threading
Performance #6  threadingPerformance #6  threading
Performance #6 threading
 
Building Hermetic Systems (without Docker)
Building Hermetic Systems (without Docker)Building Hermetic Systems (without Docker)
Building Hermetic Systems (without Docker)
 
DevDay.lk - Bare Knuckle Web Development
DevDay.lk - Bare Knuckle Web DevelopmentDevDay.lk - Bare Knuckle Web Development
DevDay.lk - Bare Knuckle Web Development
 
Web technologies-course 12.pptx
Web technologies-course 12.pptxWeb technologies-course 12.pptx
Web technologies-course 12.pptx
 
WTF is Twisted?
WTF is Twisted?WTF is Twisted?
WTF is Twisted?
 
All of Javascript
All of JavascriptAll of Javascript
All of Javascript
 
CakePHP 2.0 - It'll rock your world
CakePHP 2.0 - It'll rock your worldCakePHP 2.0 - It'll rock your world
CakePHP 2.0 - It'll rock your world
 
ELAG Workshop version 1
ELAG Workshop version 1ELAG Workshop version 1
ELAG Workshop version 1
 
Introduction to node.js
Introduction to node.jsIntroduction to node.js
Introduction to node.js
 
CSharp for Unity Day2
CSharp for Unity Day2CSharp for Unity Day2
CSharp for Unity Day2
 

Plus de Trisha Gee

Plus de Trisha Gee (20)

Career Advice for Architects
Career Advice for Architects Career Advice for Architects
Career Advice for Architects
 
Is boilerplate code really so bad?
Is boilerplate code really so bad?Is boilerplate code really so bad?
Is boilerplate code really so bad?
 
Code Review Best Practices
Code Review Best PracticesCode Review Best Practices
Code Review Best Practices
 
Career Advice for Programmers - ProgNET London
Career Advice for Programmers - ProgNET LondonCareer Advice for Programmers - ProgNET London
Career Advice for Programmers - ProgNET London
 
Is Boilerplate Code Really So Bad?
Is Boilerplate Code Really So Bad?Is Boilerplate Code Really So Bad?
Is Boilerplate Code Really So Bad?
 
Real World Java 9 - JetBrains Webinar
Real World Java 9 - JetBrains WebinarReal World Java 9 - JetBrains Webinar
Real World Java 9 - JetBrains Webinar
 
Real World Java 9
Real World Java 9Real World Java 9
Real World Java 9
 
Real World Java 9
Real World Java 9Real World Java 9
Real World Java 9
 
Career Advice for Programmers
Career Advice for Programmers Career Advice for Programmers
Career Advice for Programmers
 
Real World Java 9
Real World Java 9Real World Java 9
Real World Java 9
 
Becoming fully buzzword compliant
Becoming fully buzzword compliantBecoming fully buzzword compliant
Becoming fully buzzword compliant
 
Real World Java 9 (QCon London)
Real World Java 9 (QCon London)Real World Java 9 (QCon London)
Real World Java 9 (QCon London)
 
Java 9 Functionality and Tooling
Java 9 Functionality and ToolingJava 9 Functionality and Tooling
Java 9 Functionality and Tooling
 
Java 8 and 9 in Anger
Java 8 and 9 in AngerJava 8 and 9 in Anger
Java 8 and 9 in Anger
 
Refactoring to Java 8 (Devoxx BE)
Refactoring to Java 8 (Devoxx BE)Refactoring to Java 8 (Devoxx BE)
Refactoring to Java 8 (Devoxx BE)
 
Migrating to IntelliJ IDEA from Eclipse
Migrating to IntelliJ IDEA from EclipseMigrating to IntelliJ IDEA from Eclipse
Migrating to IntelliJ IDEA from Eclipse
 
Code Review Matters and Manners
Code Review Matters and MannersCode Review Matters and Manners
Code Review Matters and Manners
 
Refactoring to Java 8 (QCon New York)
Refactoring to Java 8 (QCon New York)Refactoring to Java 8 (QCon New York)
Refactoring to Java 8 (QCon New York)
 
Refactoring to Java 8 (Devoxx UK)
Refactoring to Java 8 (Devoxx UK)Refactoring to Java 8 (Devoxx UK)
Refactoring to Java 8 (Devoxx UK)
 
Staying Ahead of the Curve
Staying Ahead of the CurveStaying Ahead of the Curve
Staying Ahead of the Curve
 

Dernier

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Dernier (20)

ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 

Concurrent Programming Using the Disruptor

  • 1. Concurrent Programming Using The Disruptor Trisha Gee, Developer at LMAX @trisha_gee mechanitis.blogspot.com
  • 3. What I’m covering • Overview of the Disruptor • Create your own! • Turn it up to Eleven • Q&A
  • 4. What is it? • Data structure and work flow with no contention. • Very fast message passing. • Allows you to go truly parallel.
  • 13. Creating a RingBuffer final RingBuffer<SimpleEvent> ringBuffer = new RingBuffer<SimpleEvent>(SimpleEvent.EVENT_FACTORY, RING_BUFFER_SIZE);
  • 14. The Events are Buckets
  • 15. 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(); } } }
  • 16. I’ve got a RingBuffer! • Erm.... how do I poke things into it?
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24. 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);
  • 25. ...so now I want to read • The Disruptor provides nice batching behaviour for free
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41. ...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 } }
  • 44. And now for something different...
  • 45. Remember Henry Ford?
  • 46.
  • 47.
  • 48.
  • 49.
  • 50.
  • 51.
  • 52.
  • 54. What on Earth has this got to do with RingBuffers?!
  • 55.
  • 56.
  • 57.
  • 58.
  • 59.
  • 60.
  • 61.
  • 62.
  • 63.
  • 64.
  • 65.
  • 66.
  • 67.
  • 68.
  • 69.
  • 70.
  • 71.
  • 72.
  • 73.
  • 74.
  • 75.
  • 76.
  • 77.
  • 78.
  • 79.
  • 80.
  • 81.
  • 82.
  • 83.
  • 84.
  • 85.
  • 86.
  • 87.
  • 88.
  • 89.
  • 90.
  • 91.
  • 92. Don’t wrap the buffer! ringBuffer.setGatingSequences(finalEventProcessor.getSequence());
  • 94. Is that it? • Wait and claim strategies • Multiple publishers • Different EventHandlers • The Wizard
  • 95. 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 fast
  • 96. More Information • Google Code Site, including Wiki http://code.google.com/p/disruptor/ • Blogs, e.g. mine: mechanitis.blogspot.com • Presentations • Google Group
  • 97. Q&A • We are hiring! • careers@lmax.com

Notes de l'éditeur

  1. Caveats\n - Not much code - will be available\n
  2. Who has heard of it?\nWho has seen other presentations or read blogs?\nWho has played with it?\n Open Source\n Message Passing\n
  3. What it does, and how it works\nThe really cool stuff\n
  4. Uncontended data structure * except multiple producers\nWay to pass data between threads very fast\n\n
  5. That&amp;#x2019;s just words\n
  6. It is not, in fact, magic\nArray-backed ring buffer\nSequence numbers\nNothing magic\n not going to touch on: how the ring buffer doesn&amp;#x2019;t wrap; \n
  7. It is not, in fact, magic\nArray-backed ring buffer\nSequence numbers\nNothing magic\n not going to touch on: how the ring buffer doesn&amp;#x2019;t wrap; \n
  8. It is not, in fact, magic\nArray-backed ring buffer\nSequence numbers\nNothing magic\n not going to touch on: how the ring buffer doesn&amp;#x2019;t wrap; \n
  9. It is not, in fact, magic\nArray-backed ring buffer\nSequence numbers\nNothing magic\n not going to touch on: how the ring buffer doesn&amp;#x2019;t wrap; \n
  10. It is not, in fact, magic\nArray-backed ring buffer\nSequence numbers\nNothing magic\n not going to touch on: how the ring buffer doesn&amp;#x2019;t wrap; \n
  11. It is not, in fact, magic\nArray-backed ring buffer\nSequence numbers\nNothing magic\n not going to touch on: how the ring buffer doesn&amp;#x2019;t wrap; \n
  12. It is not, in fact, magic\nArray-backed ring buffer\nSequence numbers\nNothing magic\n not going to touch on: how the ring buffer doesn&amp;#x2019;t wrap; \n
  13. Generics to type it\n
  14. Garbage friendly\nReuse the events\n
  15. Garbage friendly - event factory\n\n
  16. \n
  17. Producer, writer...\nBlack &amp; White classes are provided by the Disruptor\nColoured ones are your own\n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. Disruptor provides a BatchEventProcessor \nfor heavy lifting\n
  27. Again, coloured classes for you\n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n
  34. \n
  35. \n
  36. \n
  37. \n
  38. \n
  39. \n
  40. \n
  41. \n
  42. Fast, uncontended replacement for a queue\nvery garbage friendly (or can be)\n
  43. Uncontended means things can really work in parallel\n\nHas anyone seen this before?\n
  44. \n
  45. Imagine the world&amp;#x2019;s most rubbish car\n
  46. \n
  47. \n
  48. \n
  49. \n
  50. \n
  51. \n
  52. Tada!\n
  53. \n
  54. \n
  55. \n
  56. \n
  57. \n
  58. Sequence barriers\n
  59. \n
  60. \n
  61. \n
  62. \n
  63. \n
  64. \n
  65. \n
  66. \n
  67. \n
  68. \n
  69. Maybe putting engine in takes a while\nMaybe it needs to go to a database to get the &amp;#x201C;engine&amp;#x201D;\nPassenger seat might be retrieved from another webservice\n\n
  70. \n
  71. Dude can put engines in more than one car\nDude will write engines into different cars in the ring buffer\nThis is the only thing that can write this field\n
  72. Maybe the seats are retrieved from another service\n
  73. \n
  74. 3 cars\n
  75. 2 cars\n
  76. 4 cars\n
  77. \n
  78. Bonnet is dead fast. Maybe it&amp;#x2019;s calculating the result based on what&amp;#x2019;s already in the ringbuffer\n\n
  79. Bonnet handler writes results into 33\n
  80. Front door handler is sloooow. Maybe it got caught waiting for something else, or it&amp;#x2019;s sub-optimal\nAll door handlers ask their sequence barrier for the next available sequence\nthis is the lowest of the sequence numbers that barrier is tracking\nin that case, it&amp;#x2019;s 35 - rear seat handler\n
  81. In this case its 35\n
  82. front door handler is waaaaay behind\nhe&amp;#x2019;s going to have to put his door into a bunch of cars\n
  83. \n
  84. \n
  85. \n
  86. \n
  87. Not going to show writing to the buffer\n
  88. Wheels blocked because they&amp;#x2019;re already at 27\nRingBuffer is blocked cos it can&amp;#x2019;t write any more\nBack-pressure\n
  89. \n
  90. \n
  91. \n
  92. \n
  93. Can&amp;#x2019;t run the car demo at full speed on a machine with two cores\nFields have to be volatile\nStill low contention, but you are contending upon CPU\nYour ring buffer should be bigger than 12\n
  94. \n
  95. Martin Fowler talks about DDD this morning. Aggregates.\nTake care of separate concerns in separate processes\nSharding\nJoe Armstrong spoke about handling errors outside of your process. Can have processes outside of your business logic\n\n\n
  96. \n
  97. Feedback - any interest in a workshop?\nWhat else do you want to know about?\n.net version\n