SlideShare ist ein Scribd-Unternehmen logo
1 von 16
Downloaden Sie, um offline zu lesen
The Disruptor
 High Performance Inter-Thread Messaging
 Michael Barker @mikeb2701
 Lead Developer
 LMAX


Thursday, 17 November 11
Mo’vember
   • Apologies for the silly facial hair
   • Raising money for men’s health
   • Donate!!!



                    http://mobro.co/mikeb2701



                                                2

Thursday, 17 November 11
What is the
                                         Disruptor?
                           http://code.google.com/p/disruptor

Thursday, 17 November 11
static long foo = 0;

                private static void increment() {
                    for (long l = 0; l < 500000000L; l++) {
                        foo++;
                    }
                }




Thursday, 17 November 11
public static long foo = 0;
                  public static Lock lock = new Lock();

                  private static void increment() {
                      int iterations = 500000000L / THREADS;
                      for (long l = 0; l < iterations; l++){
                          lock.lock();
                          try {
                              foo++;
                          } finally {
                              lock.unlock();
                          }
                      }
                  }


Thursday, 17 November 11
static AtomicLong foo = new AtomicLong(0);

           private static void increment() {
               int iterations = 500000000L / THREADS;
               for (long l = 0; l < iterations; l++) {
                   foo.getAndIncrement();
               }
           }




Thursday, 17 November 11
Increment a counter 500 000 000 times.

        • One Thread                     :     300 ms




Thursday, 17 November 11
Increment a counter 500 000 000 times.

        • One Thread                    :      300 ms
        • One Thread          (volatile):    4 700 ms   (15x)




Thursday, 17 November 11
Increment a counter 500 000 000 times.

        • One Thread                    :      300 ms
        • One Thread          (volatile):    4 700 ms   (15x)
        • One Thread          (Atomic) :     5 700 ms   (19x)




Thursday, 17 November 11
Increment a counter 500 000 000 times.

        •    One           Thread             :      300   ms
        •    One           Thread   (volatile):    4 700   ms   (15x)
        •    One           Thread   (Atomic) :     5 700   ms   (19x)
        •    One           Thread   (Lock)    :   10 000   ms   (33x)




Thursday, 17 November 11
Increment a counter 500 000 000 times.

        •    One           Thread              :        300   ms
        •    One           Thread    (volatile):    4   700   ms   (15x)
        •    One           Thread    (Atomic) :     5   700   ms   (19x)
        •    One           Thread    (Lock)    :   10   000   ms   (33x)
        •    Two           Threads   (Atomic) :    17   000   ms   (58x)




Thursday, 17 November 11
Increment a counter 500 000 000 times.

        •    One           Thread              :     300 ms
        •    One           Thread    (volatile):   4 700 ms (15x)
        •    One           Thread    (Atomic) :    5 700 ms (19x)
        •    One           Thread    (Lock)    : 10 000 ms (33x)
        •    Two           Threads   (Atomic) : 17 000 ms (58x)
        •    Two           Threads   (Lock)    : 104 000 ms (345x)
                                                 ^^^^^^^^
                                               > 1.5 minutes!!!




Thursday, 17 November 11
Thursday, 17 November 11
Test                         Queue       Disruptor     Factor



      OnePublisherToOneProcessorUniCastThroughputTest       2,366,171    72,087,993      30.5

      OnePublisherToThreeProcessorDiamondThroughputTest     1,590,126    63,358,798      39.8

      OnePublisherToThreeProcessorMultiCastThroughputTest     191,661    54,165,692     282.6

      OnePublisherToThreeProcessorPipelineThroughputTest    1,289,199    71,562,125      55.5

      OnePublisherToThreeWorkerPoolThroughputTest           2,175,593    10,412,567        4.8




Thursday, 17 November 11
Demo: Concert Tickets...

                                <event>             <event>
                                                                                   Concert
                                Concert              Ticket
                                                                                  Repository
                                Created             Purchase




                                          Concert                                  <entity>
                                          Service                                  Concert




                      <event>              <event>          <event>     <event>
                                                                                   <entity>
                      Concert             Allocation       Allocation   Section
                                                                                   Section
                      Created             Rejected         Approved     Updated




                                                                                               15

Thursday, 17 November 11
Demo: Concert Tickets...

                                              Concert
                                              Service



                           UDP                                                 UDP




                                        Request         Response
                                        Servlet          Servlet



                                 HTTP                              Long Poll


                                             HTTP Client


                                                                                     16

Thursday, 17 November 11

Weitere ähnliche Inhalte

Was ist angesagt?

JavaOne 2013 - Clojure for Java Developers
JavaOne 2013 - Clojure for Java DevelopersJavaOne 2013 - Clojure for Java Developers
JavaOne 2013 - Clojure for Java DevelopersJan Kronquist
 
Using QString effectively
Using QString effectivelyUsing QString effectively
Using QString effectivelyRoman Okolovich
 
Rabbitmq Boot System
Rabbitmq Boot SystemRabbitmq Boot System
Rabbitmq Boot SystemAlvaro Videla
 
Naïveté vs. Experience
Naïveté vs. ExperienceNaïveté vs. Experience
Naïveté vs. ExperienceMike Fogus
 
Coffee Scriptでenchant.js
Coffee Scriptでenchant.jsCoffee Scriptでenchant.js
Coffee Scriptでenchant.jsNaoyuki Totani
 
PyTorch crash course
PyTorch crash coursePyTorch crash course
PyTorch crash courseNader Karimi
 
Seeing with Python presented at PyCon AU 2014
Seeing with Python presented at PyCon AU 2014Seeing with Python presented at PyCon AU 2014
Seeing with Python presented at PyCon AU 2014Mark Rees
 
D-Talk: What's awesome about Ruby 2.x and Rails 4
D-Talk: What's awesome about Ruby 2.x and Rails 4D-Talk: What's awesome about Ruby 2.x and Rails 4
D-Talk: What's awesome about Ruby 2.x and Rails 4Jan Berdajs
 
Rust tutorial from Boston Meetup 2015-07-22
Rust tutorial from Boston Meetup 2015-07-22Rust tutorial from Boston Meetup 2015-07-22
Rust tutorial from Boston Meetup 2015-07-22nikomatsakis
 

Was ist angesagt? (9)

JavaOne 2013 - Clojure for Java Developers
JavaOne 2013 - Clojure for Java DevelopersJavaOne 2013 - Clojure for Java Developers
JavaOne 2013 - Clojure for Java Developers
 
Using QString effectively
Using QString effectivelyUsing QString effectively
Using QString effectively
 
Rabbitmq Boot System
Rabbitmq Boot SystemRabbitmq Boot System
Rabbitmq Boot System
 
Naïveté vs. Experience
Naïveté vs. ExperienceNaïveté vs. Experience
Naïveté vs. Experience
 
Coffee Scriptでenchant.js
Coffee Scriptでenchant.jsCoffee Scriptでenchant.js
Coffee Scriptでenchant.js
 
PyTorch crash course
PyTorch crash coursePyTorch crash course
PyTorch crash course
 
Seeing with Python presented at PyCon AU 2014
Seeing with Python presented at PyCon AU 2014Seeing with Python presented at PyCon AU 2014
Seeing with Python presented at PyCon AU 2014
 
D-Talk: What's awesome about Ruby 2.x and Rails 4
D-Talk: What's awesome about Ruby 2.x and Rails 4D-Talk: What's awesome about Ruby 2.x and Rails 4
D-Talk: What's awesome about Ruby 2.x and Rails 4
 
Rust tutorial from Boston Meetup 2015-07-22
Rust tutorial from Boston Meetup 2015-07-22Rust tutorial from Boston Meetup 2015-07-22
Rust tutorial from Boston Meetup 2015-07-22
 

Mehr von Michael Barker

Stuff I Learned About Performance
Stuff I Learned About PerformanceStuff I Learned About Performance
Stuff I Learned About PerformanceMichael Barker
 
Lock? We don't need no stinkin' locks!
Lock? We don't need no stinkin' locks!Lock? We don't need no stinkin' locks!
Lock? We don't need no stinkin' locks!Michael Barker
 

Mehr von Michael Barker (6)

Value Types
Value TypesValue Types
Value Types
 
Stuff I Learned About Performance
Stuff I Learned About PerformanceStuff I Learned About Performance
Stuff I Learned About Performance
 
Test automation 3
Test automation 3Test automation 3
Test automation 3
 
Disruptor yow2013 v2
Disruptor yow2013 v2Disruptor yow2013 v2
Disruptor yow2013 v2
 
Concurrecy techdrop
Concurrecy techdropConcurrecy techdrop
Concurrecy techdrop
 
Lock? We don't need no stinkin' locks!
Lock? We don't need no stinkin' locks!Lock? We don't need no stinkin' locks!
Lock? We don't need no stinkin' locks!
 

Kürzlich hochgeladen

Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
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 WorkerThousandEyes
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...apidays
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbuapidays
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024The Digital Insurer
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 

Kürzlich hochgeladen (20)

Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
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
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 

Disruptor tools in action

  • 1. The Disruptor High Performance Inter-Thread Messaging Michael Barker @mikeb2701 Lead Developer LMAX Thursday, 17 November 11
  • 2. Mo’vember • Apologies for the silly facial hair • Raising money for men’s health • Donate!!! http://mobro.co/mikeb2701 2 Thursday, 17 November 11
  • 3. What is the Disruptor? http://code.google.com/p/disruptor Thursday, 17 November 11
  • 4. static long foo = 0; private static void increment() { for (long l = 0; l < 500000000L; l++) { foo++; } } Thursday, 17 November 11
  • 5. public static long foo = 0; public static Lock lock = new Lock(); private static void increment() { int iterations = 500000000L / THREADS; for (long l = 0; l < iterations; l++){ lock.lock(); try { foo++; } finally { lock.unlock(); } } } Thursday, 17 November 11
  • 6. static AtomicLong foo = new AtomicLong(0); private static void increment() { int iterations = 500000000L / THREADS; for (long l = 0; l < iterations; l++) { foo.getAndIncrement(); } } Thursday, 17 November 11
  • 7. Increment a counter 500 000 000 times. • One Thread : 300 ms Thursday, 17 November 11
  • 8. Increment a counter 500 000 000 times. • One Thread : 300 ms • One Thread (volatile): 4 700 ms (15x) Thursday, 17 November 11
  • 9. Increment a counter 500 000 000 times. • One Thread : 300 ms • One Thread (volatile): 4 700 ms (15x) • One Thread (Atomic) : 5 700 ms (19x) Thursday, 17 November 11
  • 10. Increment a counter 500 000 000 times. • One Thread : 300 ms • One Thread (volatile): 4 700 ms (15x) • One Thread (Atomic) : 5 700 ms (19x) • One Thread (Lock) : 10 000 ms (33x) Thursday, 17 November 11
  • 11. Increment a counter 500 000 000 times. • One Thread : 300 ms • One Thread (volatile): 4 700 ms (15x) • One Thread (Atomic) : 5 700 ms (19x) • One Thread (Lock) : 10 000 ms (33x) • Two Threads (Atomic) : 17 000 ms (58x) Thursday, 17 November 11
  • 12. Increment a counter 500 000 000 times. • One Thread : 300 ms • One Thread (volatile): 4 700 ms (15x) • One Thread (Atomic) : 5 700 ms (19x) • One Thread (Lock) : 10 000 ms (33x) • Two Threads (Atomic) : 17 000 ms (58x) • Two Threads (Lock) : 104 000 ms (345x) ^^^^^^^^ > 1.5 minutes!!! Thursday, 17 November 11
  • 14. Test Queue Disruptor Factor OnePublisherToOneProcessorUniCastThroughputTest 2,366,171 72,087,993 30.5 OnePublisherToThreeProcessorDiamondThroughputTest 1,590,126 63,358,798 39.8 OnePublisherToThreeProcessorMultiCastThroughputTest 191,661 54,165,692 282.6 OnePublisherToThreeProcessorPipelineThroughputTest 1,289,199 71,562,125 55.5 OnePublisherToThreeWorkerPoolThroughputTest 2,175,593 10,412,567 4.8 Thursday, 17 November 11
  • 15. Demo: Concert Tickets... <event> <event> Concert Concert Ticket Repository Created Purchase Concert <entity> Service Concert <event> <event> <event> <event> <entity> Concert Allocation Allocation Section Section Created Rejected Approved Updated 15 Thursday, 17 November 11
  • 16. Demo: Concert Tickets... Concert Service UDP UDP Request Response Servlet Servlet HTTP Long Poll HTTP Client 16 Thursday, 17 November 11