Disruptor tools in action

15,096 views

Published on

0 Comments
6 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
15,096
On SlideShare
0
From Embeds
0
Number of Embeds
11,892
Actions
Shares
0
Downloads
100
Comments
0
Likes
6
Embeds 0
No embeds

No notes for slide

Disruptor tools in action

  1. 1. The Disruptor High Performance Inter-Thread Messaging Michael Barker @mikeb2701 Lead Developer LMAXThursday, 17 November 11
  2. 2. Mo’vember • Apologies for the silly facial hair • Raising money for men’s health • Donate!!! http://mobro.co/mikeb2701 2Thursday, 17 November 11
  3. 3. What is the Disruptor? http://code.google.com/p/disruptorThursday, 17 November 11
  4. 4. static long foo = 0; private static void increment() { for (long l = 0; l < 500000000L; l++) { foo++; } }Thursday, 17 November 11
  5. 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. 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. 7. Increment a counter 500 000 000 times. • One Thread : 300 msThursday, 17 November 11
  8. 8. Increment a counter 500 000 000 times. • One Thread : 300 ms • One Thread (volatile): 4 700 ms (15x)Thursday, 17 November 11
  9. 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. 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. 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. 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
  13. 13. Thursday, 17 November 11
  14. 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.8Thursday, 17 November 11
  15. 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 15Thursday, 17 November 11
  16. 16. Demo: Concert Tickets... Concert Service UDP UDP Request Response Servlet Servlet HTTP Long Poll HTTP Client 16Thursday, 17 November 11

×