SlideShare a Scribd company logo
1 of 109
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
Part #1
Message-driven
Asynchronous
Non-blocking I/O
and Back-pressure
Part #2
Elasticity
Scalability
Location Transparency
Part #3
Resiliency
Failures vs Errors
Isolation & Containment
Delegation & Replication
with Viktor Klang with Jonas Bonér
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
Konrad `ktoso` Malawski
Akka Team,
Reactive Streams TCK
(we’re renaming soon!)
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
High Performance Software
Development
For the majority of the time,
high performance software development
is not about compiler hacks and bit twiddling.
It is about fundamental design principles that are
key to doing any effective software development.
Martin Thompson
practicalperformanceanalyst.com/2015/02/17/getting-to-know-martin-thompson-.
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
Agenda
• Reactive Manifesto & our focus today
• Asynchronous vs. Synchronous
• Messages compared to Events
• Patterns enabled by Asynchronous
Messaging
• Keeping things Non-blocking: Scheduling
• Non-blocking I/O: IO, AIO, NIO, Zero
• Asynchronous Non-blocking Back-pressure
• Wrapping up and Q/A
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
Initial version published 2 years ago.
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
Initial version published 2 years ago.
A “not only Typesafe” initiative:
Jonas Bonér, Dave Farley, Roland Kuhn, and Martin Thompson
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
Initial version published 2 years ago.
A “not only Typesafe” initiative:
Jonas Bonér, Dave Farley, Roland Kuhn, and Martin Thompson
Defines a tech agnostic shared vocabulary.
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
Asynchronous
Sync / Async Basics
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
Sync / Async Basics
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
Sync / Async Basics
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
Sync / Async Basics
Implicitly back-pressures the sender,
since it can only send M2 after M1 finished.
(we’ll discuss back-pressure in depth shortly)
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
Sync / Async Basics
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
Sync / Async Basics
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
Sync / Async Basics
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
Sync / Async Basics
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
Sync / Async Basics
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
Sync / Async Basics
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
Messages compared to Events
Messages compared to Events
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
Events are not addressed to a specific receiver.
They’re just “facts”, that get published to topics.
Messages compared to Events
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
Event-based systems tend to
focus on addressable event sources.
Messages compared to Events
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
A Message can contain an Event as it’s
payload,
i.e. “listener ! SeatReserved()”.
Messages always have a specific
recipient.
Be it Actor or Topic or something else.
Messages compared to Events
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
Message-based systems tend to
focus on addressable recipients.
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
Load management
Async enables transparent load
balancing
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
Async enables transparent load
balancing
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
Async enables transparent load
balancing
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
Async enables transparent load
balancing
Response latency grows since more and
more messages pile up in the mailbox…
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
Async enables transparent load
balancing
Response latency grows since more and
more messages pile up in the mailbox…
We can:
A. back-pressure the Publisher
B. add more workers!
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
Async enables transparent load
balancing
Can add workers
dynamically.
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
Non-blocking
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
Async where it matters: Scheduling
Async where it matters: Scheduling
Async where it matters: Scheduling
Async where it matters: Scheduling
Async where it matters: Scheduling
Async where it matters: Scheduling
Async where it matters: Scheduling
Async where it matters: Scheduling
Async where it matters: Scheduling
Scheduling (notice they grey sync call)
Scheduling (notice they grey sync call)
Scheduling (now with Async db call)
Scheduling (now with Async db call)
Scheduling (now with Async db call)
Scheduling (now with Async db call)
I / O
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
IO / AIO
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
IO / AIO / NIO
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
IO / AIO / NIO / Zero
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
Interruption!
CPU: User Mode / Kernel Mode
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
Kernels and CPUs
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
Kernels and CPUs
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
Kernels and CPUs
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
Kernels and CPUs
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
Kernels and CPUs
http://wiki.osdev.org/Context_SwitchingReactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
Kernels and CPUs
[…] switching from user-level to kernel-level
on a (2.8 GHz) P4 is 1348 cycles.
[…] Counting actual time, the P4 takes 481ns […]
http://wiki.osdev.org/Context_SwitchingReactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
I / O
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
I / O
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
I / O
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
I / O
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
I / O
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
I / O
“Don’t worry.
It only gets worse!”
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
I / O
“Don’t worry.
It only gets worse!”
Same data in 3 buffers!4 mode switches!
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
Asynchronous I / O [Linux]
Linux AIO = JVM NIO
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
Asynchronous I / O [Linux]
NewIO… since 2004!
(No-one calls it “new” any more)
Linux AIO = JVM NIO
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
Asynchronous I / O [Linux]
Less time wasted waiting.
Same amount of buffer copies.
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
ZeroCopy = sendfile [Linux]
“Work smarter.
Not harder.”
http://fourhourworkweek.com/Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
ZeroCopy = sendfile [Linux]
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
ZeroCopy = sendfile [Linux]
Data never leaves kernel mode!
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
Delegating failures
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
Delegate Failures
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
Delegate Failures
Backup Requests
using
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
Backup requests
A technique for fighting “long tail latencies”.
By issuing duplicated work, when SLA seems in danger.
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
Backup requests
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
Backup requests
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
Backup requests
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
Backup requests - send
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
Backup requests - send
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
Backup requests - send
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
Backup requests
Avg Std dev 95%ile 99%ile 99.9%ile
No backups 33 ms 1524 ms 24 ms 52 ms 994 ms
After 10ms 14 ms 4 ms 20 ms 23 ms 50 ms
After 50ms 16 ms 12 ms 57 ms 63 ms 68 ms
Jeff Dean - Achieving Rapid Response Times in Large Online Services
Peter Bailis - Doing Redundant Work to Speed Up Distributed Queries
Akka - Krzysztof Janosz @ Akkathon, Kraków - TailChoppingRouter (docs, pr)
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
Lesson learned:
Backup requests allow
trade-off increased load
for decreased latency.
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
Asynchronous Back-pressure
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
Back-pressure
&
Combined Requests
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
Combined requests & back-pressure
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
Combined requests & back-pressure
No no no…!
Not THAT Back-pressure!
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
Combined requests & back-pressure
THAT kind of back-pressure:
www.reactive-streams.org Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
Combined requests & back-pressure
THAT kind of back-pressure:
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawskiwww.reactive-streams.org
Combined requests & back-pressure
THAT kind of back-pressure:
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawskiwww.reactive-streams.org
Combined requests & back-pressure
THAT kind of back-pressure:
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawskiwww.reactive-streams.org
Combined requests
A technique for avoiding duplicated work.
By aggregating requests, possibly increasing latency.
“Wat? Why would I increase latency!?”
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
Combined requests
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
Combined requests
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
Combined requests
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
Combined requests
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
Lesson learned:
Back-pressure saves systems from overload.
Combined requests trade higher latency,
for less work for the downstream.
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
Wrapping up
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
Wrapping up
• provides a shared vocabulary
• a “ubiquitous language“, for Reactive Systems
• is not re-discovering the wheel, instead just solidifies proven patterns
• is technology independent
The Reactive Manifesto
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
Wrapping up
• are loosely coupled by design
• therefore can be elastic and resilient
• allow certain patterns to be used which otherwise wouldn’t be possible
Asynchronous and Message-driven systems:
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
Links
• akka.io
• reactive-streams.org
• akka-user
• Gil Tene - How NOT to measure latency, 2013
• Jeff Dean @ Velocity 2014
• Alan Bateman, Jeanfrancois Arcand (Sun) Async IO Tips @
JavaOne
• http://linux.die.net/man/2/select
• http://linux.die.net/man/2/poll
• http://linux.die.net/man/4/epoll
• giltene/jHiccup
• Linux Journal: ZeroCopy I, Dragan Stancevis 2013
• Last slide car picture: http://actu-moteurs.com/sprint/gt-tour/jean-
philippe-belloc-un-beau-challenge-avec-le-akka-asp-team/2000
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
Links
• http://wiki.osdev.org/Context_Switching
• CppCon: Herb Sutter "Lock-Free Programming (or, Juggling Razor Blades)"
• http://www.infoq.com/presentations/reactive-services-scale
• Gil Tene’s HdrHistogram.org
• http://hdrhistogram.github.io/HdrHistogram/plotFiles.html
• Rob Pike - Concurrency is NOT Parallelism (video)
• Brendan Gregg - Systems Performance: Enterprise and the Cloud (book)
• http://psy-lob-saw.blogspot.com/2015/02/hdrhistogram-better-latency-
capture.html
• Jeff Dean, Luiz Andre Barroso - The Tail at Scale (whitepaper, ACM)
• http://highscalability.com/blog/2012/3/12/google-taming-the-long-latency-tail-
when-more-machines-equal.html
• http://www.ulduzsoft.com/2014/01/select-poll-epoll-practical-difference-for-
system-architects/
• Marcus Lagergren - Oracle JRockit: The Definitive Guide (book)
• http://mechanical-sympathy.blogspot.com/2013/08/lock-based-vs-lock-free-
concurrent.html
• Handling of Asynchronous Events - http://www.win.tue.nl/~aeb/linux/lk/lk-
12.html
• http://www.kegel.com/c10k.html
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
Links
• www.reactivemanifesto.org/
• Seriously the only right way to micro benchmark on the JVM:
• JMH openjdk.java.net/projects/code-tools/jmh/
• JMH for Scala: https://github.com/ktoso/sbt-jmh
• http://www.ibm.com/developerworks/library/l-async/
• http://lse.sourceforge.net/io/aio.html
• https://code.google.com/p/kernel/wiki/AIOUserGuide
• ShmooCon: C10M - Defending the Internet At Scale (Robert Graham)
• http://blog.erratasec.com/2013/02/scalability-its-question-that-drives-us.html#.VO6E11PF8SM
•User-level threads....... with threads. - Paul Turner @ Linux Plumbers Conf
2013
•https://www.facebook.com/themainstreetpiggyboys/photos/a.1390784047896
753.1073741829.1390594984582326/1423592294615928/?type=1&theater
for the Rollin’ Cuy on last slide
Reactive Revealed: Message Driven
with Konrad `@ktosopl` Malawski
Go Reactive
More interesting stuff…
HOW TO VIDEO
Managing Library
Dependencies with
Play, sbt & Activator
WATCH NOW
HAVE QUESTIONS?
Get in touch with
Typesafe today!
CONTACT US
SUCCESS STORY
How Walmart Canada
Saved Black Friday
with Akka, Play and
Scala
READ NOW
EXPERT TRAINING
Delivered on-site for Akka, Spark, Scala and Play
Help is just a click away. Get in touch
with Typesafe about our training courses.
• Intro Workshop to Apache Spark
• Fast Track & Advanced Scala
• Fast Track to Akka with Java or
Scala
• Fast Track to Play with Java or Scala
• Advanced Akka with Java or Scala
Ask us about local trainings available by
24 Typesafe partners in 14 countries
around the world.
CONTACT US Learn more about on-site training
©Typesafe 2015 – All Rights Reserved©Typesafe 2015 – All Rights Reserved

More Related Content

More from Legacy Typesafe (now Lightbend)

Reactive Revealed Part 2: Scalability, Elasticity and Location Transparency i...
Reactive Revealed Part 2: Scalability, Elasticity and Location Transparency i...Reactive Revealed Part 2: Scalability, Elasticity and Location Transparency i...
Reactive Revealed Part 2: Scalability, Elasticity and Location Transparency i...Legacy Typesafe (now Lightbend)
 
Microservices 101: Exploiting Reality's Constraints with Technology
Microservices 101: Exploiting Reality's Constraints with TechnologyMicroservices 101: Exploiting Reality's Constraints with Technology
Microservices 101: Exploiting Reality's Constraints with TechnologyLegacy Typesafe (now Lightbend)
 
Four Things to Know About Reliable Spark Streaming with Typesafe and Databricks
Four Things to Know About Reliable Spark Streaming with Typesafe and DatabricksFour Things to Know About Reliable Spark Streaming with Typesafe and Databricks
Four Things to Know About Reliable Spark Streaming with Typesafe and DatabricksLegacy Typesafe (now Lightbend)
 
A Deeper Look Into Reactive Streams with Akka Streams 1.0 and Slick 3.0
A Deeper Look Into Reactive Streams with Akka Streams 1.0 and Slick 3.0A Deeper Look Into Reactive Streams with Akka Streams 1.0 and Slick 3.0
A Deeper Look Into Reactive Streams with Akka Streams 1.0 and Slick 3.0Legacy Typesafe (now Lightbend)
 
Modernizing Your Aging Architecture: What Enterprise Architects Need To Know ...
Modernizing Your Aging Architecture: What Enterprise Architects Need To Know ...Modernizing Your Aging Architecture: What Enterprise Architects Need To Know ...
Modernizing Your Aging Architecture: What Enterprise Architects Need To Know ...Legacy Typesafe (now Lightbend)
 
Reactive Streams 1.0.0 and Why You Should Care (webinar)
Reactive Streams 1.0.0 and Why You Should Care (webinar)Reactive Streams 1.0.0 and Why You Should Care (webinar)
Reactive Streams 1.0.0 and Why You Should Care (webinar)Legacy Typesafe (now Lightbend)
 
[Sneak Preview] Apache Spark: Preparing for the next wave of Reactive Big Data
[Sneak Preview] Apache Spark: Preparing for the next wave of Reactive Big Data[Sneak Preview] Apache Spark: Preparing for the next wave of Reactive Big Data
[Sneak Preview] Apache Spark: Preparing for the next wave of Reactive Big DataLegacy Typesafe (now Lightbend)
 

More from Legacy Typesafe (now Lightbend) (9)

Reactive Revealed Part 2: Scalability, Elasticity and Location Transparency i...
Reactive Revealed Part 2: Scalability, Elasticity and Location Transparency i...Reactive Revealed Part 2: Scalability, Elasticity and Location Transparency i...
Reactive Revealed Part 2: Scalability, Elasticity and Location Transparency i...
 
Microservices 101: Exploiting Reality's Constraints with Technology
Microservices 101: Exploiting Reality's Constraints with TechnologyMicroservices 101: Exploiting Reality's Constraints with Technology
Microservices 101: Exploiting Reality's Constraints with Technology
 
Four Things to Know About Reliable Spark Streaming with Typesafe and Databricks
Four Things to Know About Reliable Spark Streaming with Typesafe and DatabricksFour Things to Know About Reliable Spark Streaming with Typesafe and Databricks
Four Things to Know About Reliable Spark Streaming with Typesafe and Databricks
 
A Deeper Look Into Reactive Streams with Akka Streams 1.0 and Slick 3.0
A Deeper Look Into Reactive Streams with Akka Streams 1.0 and Slick 3.0A Deeper Look Into Reactive Streams with Akka Streams 1.0 and Slick 3.0
A Deeper Look Into Reactive Streams with Akka Streams 1.0 and Slick 3.0
 
Modernizing Your Aging Architecture: What Enterprise Architects Need To Know ...
Modernizing Your Aging Architecture: What Enterprise Architects Need To Know ...Modernizing Your Aging Architecture: What Enterprise Architects Need To Know ...
Modernizing Your Aging Architecture: What Enterprise Architects Need To Know ...
 
Reactive Streams 1.0.0 and Why You Should Care (webinar)
Reactive Streams 1.0.0 and Why You Should Care (webinar)Reactive Streams 1.0.0 and Why You Should Care (webinar)
Reactive Streams 1.0.0 and Why You Should Care (webinar)
 
Going Reactive in Java with Typesafe Reactive Platform
Going Reactive in Java with Typesafe Reactive PlatformGoing Reactive in Java with Typesafe Reactive Platform
Going Reactive in Java with Typesafe Reactive Platform
 
Why Play Framework is fast
Why Play Framework is fastWhy Play Framework is fast
Why Play Framework is fast
 
[Sneak Preview] Apache Spark: Preparing for the next wave of Reactive Big Data
[Sneak Preview] Apache Spark: Preparing for the next wave of Reactive Big Data[Sneak Preview] Apache Spark: Preparing for the next wave of Reactive Big Data
[Sneak Preview] Apache Spark: Preparing for the next wave of Reactive Big Data
 

Recently uploaded

PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentationvaddepallysandeep122
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Angel Borroy López
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Natan Silnitsky
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Velvetech LLC
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odishasmiwainfosol
 
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdfInnovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdfYashikaSharma391629
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfStefano Stabellini
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...Technogeeks
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Cizo Technology Services
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...OnePlan Solutions
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commercemanigoyal112
 
How To Manage Restaurant Staff -BTRESTRO
How To Manage Restaurant Staff -BTRESTROHow To Manage Restaurant Staff -BTRESTRO
How To Manage Restaurant Staff -BTRESTROmotivationalword821
 
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxUI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxAndreas Kunz
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Developmentvyaparkranti
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanyChristoph Pohl
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfFerryKemperman
 

Recently uploaded (20)

PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentation
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
 
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdfInnovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdf
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdf
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commerce
 
How To Manage Restaurant Staff -BTRESTRO
How To Manage Restaurant Staff -BTRESTROHow To Manage Restaurant Staff -BTRESTRO
How To Manage Restaurant Staff -BTRESTRO
 
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxUI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Development
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdf
 

Reactive Revealed P1 - Async NIO, Back-pressure and Message- vs Event-driven

  • 1. Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski Part #1 Message-driven Asynchronous Non-blocking I/O and Back-pressure
  • 2. Part #2 Elasticity Scalability Location Transparency Part #3 Resiliency Failures vs Errors Isolation & Containment Delegation & Replication with Viktor Klang with Jonas Bonér Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 3. Konrad `ktoso` Malawski Akka Team, Reactive Streams TCK (we’re renaming soon!) Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 4. High Performance Software Development For the majority of the time, high performance software development is not about compiler hacks and bit twiddling. It is about fundamental design principles that are key to doing any effective software development. Martin Thompson practicalperformanceanalyst.com/2015/02/17/getting-to-know-martin-thompson-. Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 5. Agenda • Reactive Manifesto & our focus today • Asynchronous vs. Synchronous • Messages compared to Events • Patterns enabled by Asynchronous Messaging • Keeping things Non-blocking: Scheduling • Non-blocking I/O: IO, AIO, NIO, Zero • Asynchronous Non-blocking Back-pressure • Wrapping up and Q/A Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 6. Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 7. Initial version published 2 years ago. Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 8. Initial version published 2 years ago. A “not only Typesafe” initiative: Jonas Bonér, Dave Farley, Roland Kuhn, and Martin Thompson Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 9. Initial version published 2 years ago. A “not only Typesafe” initiative: Jonas Bonér, Dave Farley, Roland Kuhn, and Martin Thompson Defines a tech agnostic shared vocabulary. Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 10. Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 11. Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 12. Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski Asynchronous
  • 13. Sync / Async Basics Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 14. Sync / Async Basics Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 15. Sync / Async Basics Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 16. Sync / Async Basics Implicitly back-pressures the sender, since it can only send M2 after M1 finished. (we’ll discuss back-pressure in depth shortly) Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 17. Sync / Async Basics Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 18. Sync / Async Basics Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 19. Sync / Async Basics Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 20. Sync / Async Basics Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 21. Sync / Async Basics Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 22. Sync / Async Basics Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 23. Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski Messages compared to Events
  • 24. Messages compared to Events Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski Events are not addressed to a specific receiver. They’re just “facts”, that get published to topics.
  • 25. Messages compared to Events Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski Event-based systems tend to focus on addressable event sources.
  • 26. Messages compared to Events Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski A Message can contain an Event as it’s payload, i.e. “listener ! SeatReserved()”. Messages always have a specific recipient. Be it Actor or Topic or something else.
  • 27. Messages compared to Events Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski Message-based systems tend to focus on addressable recipients.
  • 28. Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski Load management
  • 29. Async enables transparent load balancing Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 30. Async enables transparent load balancing Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 31. Async enables transparent load balancing Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 32. Async enables transparent load balancing Response latency grows since more and more messages pile up in the mailbox… Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 33. Async enables transparent load balancing Response latency grows since more and more messages pile up in the mailbox… We can: A. back-pressure the Publisher B. add more workers! Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 34. Async enables transparent load balancing Can add workers dynamically. Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 35. Non-blocking Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 36. Async where it matters: Scheduling
  • 37. Async where it matters: Scheduling
  • 38. Async where it matters: Scheduling
  • 39. Async where it matters: Scheduling
  • 40. Async where it matters: Scheduling
  • 41. Async where it matters: Scheduling
  • 42. Async where it matters: Scheduling
  • 43. Async where it matters: Scheduling
  • 44. Async where it matters: Scheduling
  • 45. Scheduling (notice they grey sync call)
  • 46. Scheduling (notice they grey sync call)
  • 47. Scheduling (now with Async db call)
  • 48. Scheduling (now with Async db call)
  • 49. Scheduling (now with Async db call)
  • 50. Scheduling (now with Async db call)
  • 51. I / O Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 52. IO / AIO Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 53. IO / AIO / NIO Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 54. IO / AIO / NIO / Zero Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 55. Interruption! CPU: User Mode / Kernel Mode Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 56. Kernels and CPUs Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 57. Kernels and CPUs Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 58. Kernels and CPUs Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 59. Kernels and CPUs Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 60. Kernels and CPUs http://wiki.osdev.org/Context_SwitchingReactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 61. Kernels and CPUs […] switching from user-level to kernel-level on a (2.8 GHz) P4 is 1348 cycles. […] Counting actual time, the P4 takes 481ns […] http://wiki.osdev.org/Context_SwitchingReactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 62. I / O Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 63. I / O Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 64. I / O Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 65. I / O Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 66. I / O Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 67. I / O “Don’t worry. It only gets worse!” Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 68. I / O “Don’t worry. It only gets worse!” Same data in 3 buffers!4 mode switches! Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 69. Asynchronous I / O [Linux] Linux AIO = JVM NIO Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 70. Asynchronous I / O [Linux] NewIO… since 2004! (No-one calls it “new” any more) Linux AIO = JVM NIO Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 71. Asynchronous I / O [Linux] Less time wasted waiting. Same amount of buffer copies. Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 72. ZeroCopy = sendfile [Linux] “Work smarter. Not harder.” http://fourhourworkweek.com/Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 73. ZeroCopy = sendfile [Linux] Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 74. ZeroCopy = sendfile [Linux] Data never leaves kernel mode! Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 75. Delegating failures Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 76. Delegate Failures Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 77. Delegate Failures Backup Requests using Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 78. Backup requests A technique for fighting “long tail latencies”. By issuing duplicated work, when SLA seems in danger. Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 79. Backup requests Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 80. Backup requests Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 81. Backup requests Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 82. Backup requests - send Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 83. Backup requests - send Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 84. Backup requests - send Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 85. Backup requests Avg Std dev 95%ile 99%ile 99.9%ile No backups 33 ms 1524 ms 24 ms 52 ms 994 ms After 10ms 14 ms 4 ms 20 ms 23 ms 50 ms After 50ms 16 ms 12 ms 57 ms 63 ms 68 ms Jeff Dean - Achieving Rapid Response Times in Large Online Services Peter Bailis - Doing Redundant Work to Speed Up Distributed Queries Akka - Krzysztof Janosz @ Akkathon, Kraków - TailChoppingRouter (docs, pr) Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 86. Lesson learned: Backup requests allow trade-off increased load for decreased latency. Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 87. Asynchronous Back-pressure Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 88. Back-pressure & Combined Requests Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 89. Combined requests & back-pressure Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 90. Combined requests & back-pressure No no no…! Not THAT Back-pressure! Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 91. Combined requests & back-pressure THAT kind of back-pressure: www.reactive-streams.org Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 92. Combined requests & back-pressure THAT kind of back-pressure: Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawskiwww.reactive-streams.org
  • 93. Combined requests & back-pressure THAT kind of back-pressure: Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawskiwww.reactive-streams.org
  • 94. Combined requests & back-pressure THAT kind of back-pressure: Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawskiwww.reactive-streams.org
  • 95. Combined requests A technique for avoiding duplicated work. By aggregating requests, possibly increasing latency. “Wat? Why would I increase latency!?” Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 96. Combined requests Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 97. Combined requests Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 98. Combined requests Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 99. Combined requests Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 100. Lesson learned: Back-pressure saves systems from overload. Combined requests trade higher latency, for less work for the downstream. Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 101. Wrapping up Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 102. Wrapping up • provides a shared vocabulary • a “ubiquitous language“, for Reactive Systems • is not re-discovering the wheel, instead just solidifies proven patterns • is technology independent The Reactive Manifesto Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 103. Wrapping up • are loosely coupled by design • therefore can be elastic and resilient • allow certain patterns to be used which otherwise wouldn’t be possible Asynchronous and Message-driven systems: Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 104. Links • akka.io • reactive-streams.org • akka-user • Gil Tene - How NOT to measure latency, 2013 • Jeff Dean @ Velocity 2014 • Alan Bateman, Jeanfrancois Arcand (Sun) Async IO Tips @ JavaOne • http://linux.die.net/man/2/select • http://linux.die.net/man/2/poll • http://linux.die.net/man/4/epoll • giltene/jHiccup • Linux Journal: ZeroCopy I, Dragan Stancevis 2013 • Last slide car picture: http://actu-moteurs.com/sprint/gt-tour/jean- philippe-belloc-un-beau-challenge-avec-le-akka-asp-team/2000 Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 105. Links • http://wiki.osdev.org/Context_Switching • CppCon: Herb Sutter "Lock-Free Programming (or, Juggling Razor Blades)" • http://www.infoq.com/presentations/reactive-services-scale • Gil Tene’s HdrHistogram.org • http://hdrhistogram.github.io/HdrHistogram/plotFiles.html • Rob Pike - Concurrency is NOT Parallelism (video) • Brendan Gregg - Systems Performance: Enterprise and the Cloud (book) • http://psy-lob-saw.blogspot.com/2015/02/hdrhistogram-better-latency- capture.html • Jeff Dean, Luiz Andre Barroso - The Tail at Scale (whitepaper, ACM) • http://highscalability.com/blog/2012/3/12/google-taming-the-long-latency-tail- when-more-machines-equal.html • http://www.ulduzsoft.com/2014/01/select-poll-epoll-practical-difference-for- system-architects/ • Marcus Lagergren - Oracle JRockit: The Definitive Guide (book) • http://mechanical-sympathy.blogspot.com/2013/08/lock-based-vs-lock-free- concurrent.html • Handling of Asynchronous Events - http://www.win.tue.nl/~aeb/linux/lk/lk- 12.html • http://www.kegel.com/c10k.html Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 106. Links • www.reactivemanifesto.org/ • Seriously the only right way to micro benchmark on the JVM: • JMH openjdk.java.net/projects/code-tools/jmh/ • JMH for Scala: https://github.com/ktoso/sbt-jmh • http://www.ibm.com/developerworks/library/l-async/ • http://lse.sourceforge.net/io/aio.html • https://code.google.com/p/kernel/wiki/AIOUserGuide • ShmooCon: C10M - Defending the Internet At Scale (Robert Graham) • http://blog.erratasec.com/2013/02/scalability-its-question-that-drives-us.html#.VO6E11PF8SM •User-level threads....... with threads. - Paul Turner @ Linux Plumbers Conf 2013 •https://www.facebook.com/themainstreetpiggyboys/photos/a.1390784047896 753.1073741829.1390594984582326/1423592294615928/?type=1&theater for the Rollin’ Cuy on last slide Reactive Revealed: Message Driven with Konrad `@ktosopl` Malawski
  • 107. Go Reactive More interesting stuff… HOW TO VIDEO Managing Library Dependencies with Play, sbt & Activator WATCH NOW HAVE QUESTIONS? Get in touch with Typesafe today! CONTACT US SUCCESS STORY How Walmart Canada Saved Black Friday with Akka, Play and Scala READ NOW
  • 108. EXPERT TRAINING Delivered on-site for Akka, Spark, Scala and Play Help is just a click away. Get in touch with Typesafe about our training courses. • Intro Workshop to Apache Spark • Fast Track & Advanced Scala • Fast Track to Akka with Java or Scala • Fast Track to Play with Java or Scala • Advanced Akka with Java or Scala Ask us about local trainings available by 24 Typesafe partners in 14 countries around the world. CONTACT US Learn more about on-site training
  • 109. ©Typesafe 2015 – All Rights Reserved©Typesafe 2015 – All Rights Reserved

Editor's Notes

  1. The company soon to be previously known as Typesafe
  2. the only slide with so much text
  3. it’s a lot, so we’ll see if we can make it.
  4. Dave - author of Continious Delivery books; Martin (LMAX, Disruptor Aeron fame)
  5. Dave - author of Continious Delivery books; Martin (LMAX, Disruptor Aeron fame)
  6. Dave - author of Continious Delivery books; Martin (LMAX, Disruptor Aeron fame)
  7. Our focus today will be “message driven” and what it means.
  8. Dave - author of Continious Delivery books; Martin (LMAX, Disruptor Aeron fame)
  9. Dave - author of Continious Delivery books; Martin (LMAX, Disruptor Aeron fame)
  10. What does this gain us?
  11. biggest difference is that it has a specific destination
  12. What does this gain us?
  13. What does this gain us?
  14. What does this gain us?
  15. What does this gain us?
  16. Dave - author of Continious Delivery books; Martin (LMAX, Disruptor Aeron fame)
  17. What does this gain us?
  18. What does this gain us?
  19. What does this gain us?
  20. What does this gain us?
  21. What does this gain us?
  22. this only works because the workers are async (and they can directly reply to the sender for example). It would not work if we would be keeping the resource locked until the message is handled.
  23. Dave - author of Continious Delivery books; Martin (LMAX, Disruptor Aeron fame)
  24. Red line means he’s waiting for resources - only 2 cpus…
  25. So at the end of each computation of the other actors, this actor may get scheduled. This depends on the throughput setting of the used dispatcher though!
  26. So at the end of each computation of the other actors, this actor may get scheduled. This depends on the throughput setting of the used dispatcher though!
  27. So at the end of each computation of the other actors, this actor may get scheduled. This depends on the throughput setting of the used dispatcher though!
  28. Fairness is a tough beast - the Linux kernel has been evolving a lot in this respect. First the O(n) scheduler, then O(1), then CompletelyFairScheduler (has redblacktree, not runlists)
  29. So at the end of each computation of the other actors, this actor may get scheduled. fairness depends on throughputs and schedulers - HOW they schedule.
  30. So at the end of each computation of the other actors, this actor may get scheduled. This depends on the throughput setting of the used dispatcher though!
  31. So at the end of each computation of the other actors, this actor may get scheduled. This depends on the throughput setting of the used dispatcher though!
  32. So at the end of each computation of the other actors, this actor may get scheduled. This depends on the throughput setting of the used dispatcher though!
  33. So at the end of each computation of the other actors, this actor may get scheduled. This depends on the throughput setting of the used dispatcher though!
  34. These are syscalls
  35. Dave - author of Continious Delivery books; Martin (LMAX, Disruptor Aeron fame)
  36. So at the end of each computation of the other actors, this actor may get scheduled. This depends on the throughput setting of the used dispatcher though!
  37. Dave - author of Continious Delivery books; Martin (LMAX, Disruptor Aeron fame)
  38. So at the end of each computation of the other actors, this actor may get scheduled. This depends on the throughput setting of the used dispatcher though!