SlideShare une entreprise Scribd logo
1  sur  48
Télécharger pour lire hors ligne
Concurrent Programming
                          Using The Disruptor
                            Trisha Gee, Developer at LMAX
                                       @trisha_gee
                                   mechanitis.blogspot.com




Tuesday, 9 October 12
The Disruptor?




Tuesday, 9 October 12
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
The Magic RingBuffer




Tuesday, 9 October 12
The Magic RingBuffer




Tuesday, 9 October 12
The Magic RingBuffer




Tuesday, 9 October 12
The Magic RingBuffer




Tuesday, 9 October 12
The Magic RingBuffer




Tuesday, 9 October 12
The Magic RingBuffer




Tuesday, 9 October 12
The Magic RingBuffer




Tuesday, 9 October 12
The Events are Buckets




Tuesday, 9 October 12
I’ve got a RingBuffer!


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



Tuesday, 9 October 12
The Publisher




Tuesday, 9 October 12
Tuesday, 9 October 12
Tuesday, 9 October 12
Tuesday, 9 October 12
Tuesday, 9 October 12
Tuesday, 9 October 12
Tuesday, 9 October 12
...so now I want to read


                    • The Disruptor provides nice batching
                        behaviour for free




Tuesday, 9 October 12
BatchEventProcessor




Tuesday, 9 October 12
Tuesday, 9 October 12
Tuesday, 9 October 12
Tuesday, 9 October 12
Tuesday, 9 October 12
Tuesday, 9 October 12
Tuesday, 9 October 12
Tuesday, 9 October 12
Tuesday, 9 October 12
Tuesday, 9 October 12
Tuesday, 9 October 12
Tuesday, 9 October 12
Tuesday, 9 October 12
Tuesday, 9 October 12
Tuesday, 9 October 12
Shiny. So what?



Tuesday, 9 October 12
Complex Workflows




Tuesday, 9 October 12
...and in the Disruptor?




Tuesday, 9 October 12
Let’s go parallel




Tuesday, 9 October 12
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
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
Is that it?

                    • Wait strategies
                    • Batch publishing
                    • Multiple publishers
                    • The Wizard
                    • You don’t even need a RingBuffer...

Tuesday, 9 October 12
More Information

                    • Github:
                        github.com/LMAX-Exchange/disruptor
                    • Google Group
                    • Blogs


Tuesday, 9 October 12
Q&A



Tuesday, 9 October 12
WorkerPool




Tuesday, 9 October 12
AggregateEventHandler




Tuesday, 9 October 12
WaitStrategies

                    • BlockingWaitStrategy
                    • BusySpinWaitStrategy
                    • SleepingWaitStrategy
                    • YieldingWaitStrategy

Tuesday, 9 October 12
ClaimStrategies

                    • SingleThreadedClaimStrategy
                    • MultiThreadedClaimStrategy
                    • MultiThreadedLowContentionClaimStrategy


Tuesday, 9 October 12

Contenu connexe

Tendances

Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to Redis
Dvir Volk
 
Introduction to Storm
Introduction to Storm Introduction to Storm
Introduction to Storm
Chandler Huang
 

Tendances (20)

cLoki: Like Loki but for ClickHouse
cLoki: Like Loki but for ClickHousecLoki: Like Loki but for ClickHouse
cLoki: Like Loki but for ClickHouse
 
Ceph and RocksDB
Ceph and RocksDBCeph and RocksDB
Ceph and RocksDB
 
Solving PostgreSQL wicked problems
Solving PostgreSQL wicked problemsSolving PostgreSQL wicked problems
Solving PostgreSQL wicked problems
 
Redis cluster
Redis clusterRedis cluster
Redis cluster
 
Apache Iceberg - A Table Format for Hige Analytic Datasets
Apache Iceberg - A Table Format for Hige Analytic DatasetsApache Iceberg - A Table Format for Hige Analytic Datasets
Apache Iceberg - A Table Format for Hige Analytic Datasets
 
RedisConf17- Using Redis at scale @ Twitter
RedisConf17- Using Redis at scale @ TwitterRedisConf17- Using Redis at scale @ Twitter
RedisConf17- Using Redis at scale @ Twitter
 
Apache ZooKeeper
Apache ZooKeeperApache ZooKeeper
Apache ZooKeeper
 
Using ClickHouse for Experimentation
Using ClickHouse for ExperimentationUsing ClickHouse for Experimentation
Using ClickHouse for Experimentation
 
Best Practices for Running PostgreSQL on AWS - DAT314 - re:Invent 2017
Best Practices for Running PostgreSQL on AWS - DAT314 - re:Invent 2017Best Practices for Running PostgreSQL on AWS - DAT314 - re:Invent 2017
Best Practices for Running PostgreSQL on AWS - DAT314 - re:Invent 2017
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to Redis
 
Scalability, Availability & Stability Patterns
Scalability, Availability & Stability PatternsScalability, Availability & Stability Patterns
Scalability, Availability & Stability Patterns
 
[Meetup] a successful migration from elastic search to clickhouse
[Meetup] a successful migration from elastic search to clickhouse[Meetup] a successful migration from elastic search to clickhouse
[Meetup] a successful migration from elastic search to clickhouse
 
Apache Spark Architecture
Apache Spark ArchitectureApache Spark Architecture
Apache Spark Architecture
 
Introduction to Kafka Cruise Control
Introduction to Kafka Cruise ControlIntroduction to Kafka Cruise Control
Introduction to Kafka Cruise Control
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to Redis
 
Squirreling Away $640 Billion: How Stripe Leverages Flink for Change Data Cap...
Squirreling Away $640 Billion: How Stripe Leverages Flink for Change Data Cap...Squirreling Away $640 Billion: How Stripe Leverages Flink for Change Data Cap...
Squirreling Away $640 Billion: How Stripe Leverages Flink for Change Data Cap...
 
Integrating Apache NiFi and Apache Flink
Integrating Apache NiFi and Apache FlinkIntegrating Apache NiFi and Apache Flink
Integrating Apache NiFi and Apache Flink
 
Introduction to Storm
Introduction to Storm Introduction to Storm
Introduction to Storm
 
CockroachDB
CockroachDBCockroachDB
CockroachDB
 
[KubeCon EU 2022] Running containerd and k3s on macOS
[KubeCon EU 2022] Running containerd and k3s on macOS[KubeCon EU 2022] Running containerd and k3s on macOS
[KubeCon EU 2022] Running containerd and k3s on macOS
 

Similaire à Introduction to the Disruptor

Performance for Product Developers
Performance for Product DevelopersPerformance for Product Developers
Performance for Product Developers
Matthew Wilkes
 
99 inception-deck
99 inception-deck99 inception-deck
99 inception-deck
drewz lin
 
Ryan Tech Tools EWBC 2012
Ryan Tech Tools EWBC 2012Ryan Tech Tools EWBC 2012
Ryan Tech Tools EWBC 2012
Ryan Opaz
 
Social Gaming & Gambling Summit - London Chris Anderson
Social Gaming & Gambling Summit - London Chris AndersonSocial Gaming & Gambling Summit - London Chris Anderson
Social Gaming & Gambling Summit - London Chris Anderson
Mediabistro
 
Internship dotCloud
Internship dotCloudInternship dotCloud
Internship dotCloud
Jill Mee
 
Kotlin: Incompetence * Motivation = Innovation?
Kotlin: Incompetence * Motivation = Innovation?Kotlin: Incompetence * Motivation = Innovation?
Kotlin: Incompetence * Motivation = Innovation?
Andrey Breslav
 
iFixit @ Monterey Bay Aquarium
iFixit @ Monterey Bay AquariumiFixit @ Monterey Bay Aquarium
iFixit @ Monterey Bay Aquarium
Kyle Wiens
 

Similaire à Introduction to the Disruptor (20)

[Phind] Miracle
[Phind] Miracle[Phind] Miracle
[Phind] Miracle
 
Java performance: What's the big deal? - Trisha Gee
Java performance: What's the big deal? - Trisha GeeJava performance: What's the big deal? - Trisha Gee
Java performance: What's the big deal? - Trisha Gee
 
Why not to use Rails? (actually it's when not to use Rails)
Why not to use Rails? (actually it's when not to use Rails)Why not to use Rails? (actually it's when not to use Rails)
Why not to use Rails? (actually it's when not to use Rails)
 
Performance for Product Developers
Performance for Product DevelopersPerformance for Product Developers
Performance for Product Developers
 
WordPress Security
WordPress SecurityWordPress Security
WordPress Security
 
99 inception-deck
99 inception-deck99 inception-deck
99 inception-deck
 
Ryan Tech Tools EWBC 2012
Ryan Tech Tools EWBC 2012Ryan Tech Tools EWBC 2012
Ryan Tech Tools EWBC 2012
 
Maximiliano Firtman
Maximiliano FirtmanMaximiliano Firtman
Maximiliano Firtman
 
Optimizing WordPress Performance on Shared Web Hosting
Optimizing WordPress Performance on Shared Web HostingOptimizing WordPress Performance on Shared Web Hosting
Optimizing WordPress Performance on Shared Web Hosting
 
How to Get a Job at a Startup
How to Get a Job at a StartupHow to Get a Job at a Startup
How to Get a Job at a Startup
 
living drupal
living drupalliving drupal
living drupal
 
Social Gaming & Gambling Summit - London Chris Anderson
Social Gaming & Gambling Summit - London Chris AndersonSocial Gaming & Gambling Summit - London Chris Anderson
Social Gaming & Gambling Summit - London Chris Anderson
 
Technical Debt
Technical DebtTechnical Debt
Technical Debt
 
Adapt and respond: keeping responsive into the future
Adapt and respond: keeping responsive into the futureAdapt and respond: keeping responsive into the future
Adapt and respond: keeping responsive into the future
 
Scrum by roofimon
Scrum by roofimonScrum by roofimon
Scrum by roofimon
 
Internship dotCloud
Internship dotCloudInternship dotCloud
Internship dotCloud
 
Kotlin: Incompetence * Motivation = Innovation?
Kotlin: Incompetence * Motivation = Innovation?Kotlin: Incompetence * Motivation = Innovation?
Kotlin: Incompetence * Motivation = Innovation?
 
Is Agile The New Waterfall
Is Agile The New WaterfallIs Agile The New Waterfall
Is Agile The New Waterfall
 
iFixit @ Monterey Bay Aquarium
iFixit @ Monterey Bay AquariumiFixit @ Monterey Bay Aquarium
iFixit @ Monterey Bay Aquarium
 
Cooking an Omelette with Chef
Cooking an Omelette with ChefCooking an Omelette with Chef
Cooking an Omelette with Chef
 

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
 

Introduction to the Disruptor