Be Reactive! at Functional and Reactive Programmers Group, Kaiserslautern March 31 2015

Lutz Hühnken
Lutz HühnkenHead of Engineering at Upvest
Be Reactive!
What’s happening?
Be Reactive! at Functional and Reactive Programmers Group, Kaiserslautern March 31 2015
Be Reactive! at Functional and Reactive Programmers Group, Kaiserslautern March 31 2015
Be Reactive! at Functional and Reactive Programmers Group, Kaiserslautern March 31 2015
Be Reactive! at Functional and Reactive Programmers Group, Kaiserslautern March 31 2015
Be Reactive! SUG KL March 2015
Elastic
• Ability to scale, but also
• be efficient, leverage modern multi- / many-core hardware
• Scale up and down - Clusters need to support joining and
leaving of nodes
• To scale, every part must scale - no single point of failure, no
contention
7
Be Reactive! SUG KL March 2015
Resilient
• Failure is embraced as a regular state in the system
• Resilience is a first-class concept in your software
• Failure is detected, isolated, and managed
• Applications can recover from failure of parts (self-heal)
8
Be Reactive! SUG KL March 2015
Before we get to message-driven
• Let’s talk about
• Multi-Threading
• I/O
• Distribution
• Deployment
9
Threads vs. task level concurrency
Be Reactive! SUG KL March 2015
A supposedly great idea
• Threads are
• lightweight processes
• easier programming model, no IPC
11
Be Reactive! SUG KL March 2015
Lightweight?
12
Slide stolen from John Rose, Java VM Architect, JFokus, Stockholm, February 2015
Be Reactive! SUG KL March 2015
The problem with Threads
13
They discard the most essential and
appealing properties of sequential
computation: understandability,
predictability, and determinism.
Threads, as a model of computation,
are wildly nondeterministic, and the
job of the programmer becomes one
of pruning that nondeterminism.
+
Let’s talk about
Multi-Threading
Be Reactive! SUG KL March 2015
Threads
• not efficient
• memory consumption
• cost for context switch
• shared memory bad for modern NUMA architectures
• locks lead to contention

• not a good programming model
• shared mutual state is difficult to reason about
15
Be Reactive! SUG KL March 2015
Tasks
Better
• task level (sub-thread) concurrency
• share nothing approach
• # threads ~ # of cores
• Example: Actors, Play Actions
16
Blocking vs. non-blocking I/O
Be Reactive! SUG KL March 2015
High concurrency matters
18
But there’s one thing we can all agree on: At high levels of
concurrency (thousands of connections) your server needs to go to
asynchronous non-blocking. [..] any part of your server code blocks
you’re going to need a thread. And at these levels of concurrency, you
can’t go creating threads for every connection.
From https://strongloop.com/strongblog/node-js-is-faster-than-java/
Be Reactive! SUG KL March 2015
Blocking I/O, Thread-per-request
19
From https://strongloop.com/strongblog/node-js-is-faster-than-java/
Be Reactive! SUG KL March 2015
Non-blocking I/O
20
Note: Single Thread is crazy! What about your other cores?
Be Reactive! SUG KL March 2015
Non-blocking
21
For task level (sub-thread level) concurrency
• each thread is responsible for n tasks
• and that n might be pretty big
You don’t want to block such a thread with blocking I/O
What if you must?
Separate!
Distributed Transactions vs. EC
Be Reactive! SUG KL March 2015
Life beyond Distributed Transactions
23
In general, application developers
simply do not implement large
scalable applications assuming
distributed transactions. When they
attempt to use distributed
transactions, the projects founder
because the performance costs and
fragility make them impractical. [..]
Instead, applications are built using
different techniques which do not
provide the same transactional
guarantees but still meet the needs of
their businesses.
24
Want Almost-Infinite Scaling

• More of everything… Year by year, bigger and bigger
• If it fits on your machines, multiply by 10, if that fits, multiply by 1000…
• Strive to scale almost linearly (N log N for some big log).
Assumptions

(Don’t Have to Prove These… Just Plain Believe Them)
Grown-Ups Don’t Use Distributed Transactions
•The apps using distributed transactions become too fragile…
• Let’s just consider local transactions.
! Multiple disjoint scopes of serializability
Want Scale-Agnostic Apps

• Two layers to the application: 

scale-agnostic and scale-aware
• Consider scale-agnostic API
Scale Agnostic Code
Scale-Aware-Code
Application
Upper Layer
Lower Layer
Scale Agnostic API
Be Reactive! SUG KL March 2015
Distributed Transactions
25
Distributed Transactions („2PC“) are a source of
unnecessary failure and of contention.
It can usually be avoided. In the aforementioned paper by
Pat Helland, he shows how to use local transactions and
at-least-once delivery instead.
The data storage landscape is changing, moving towards
event sourcing and immutability. This is a great match for
reactive systems.
App Servers vs. Containerless
Be Reactive! SUG KL March 2015 27
Be Reactive! SUG KL March 2015 28
Be Reactive! SUG KL March 2015
Java EE Application Servers
29
Servlet API was developed for thread-per-request,
synchronous I/O.
Application servers are not of much use anyway, nobody
uses them as containers for multiple applications.
Go containerless.
Summary
Be Reactive! SUG KL March 2015
Checklist
31
If
• Threads are the smallest unit of concurrency in your
code, or
• You use blocking I/O (without clear separation), or
• You use 2-phase-commit across systems, or
• You run in a Java EE Application Server
Then your application is not reactive.
Be Reactive! SUG KL March 2015
Want list
32
• Task-level (sub-thread level) concurrency
• Non-blocking I/O
• Distribution
• Containerless
Bonus: A simple, unified programming model
.. gives you all that
Be Reactive! SUG KL March 2015
Message-Driven
• Loosely coupled architecture, easier to extend, maintain, evolve
• Asynchronous and non-blocking
• Concurrent by design, immutable state
• Lower latency and higher throughput
34
Be Reactive! at Functional and Reactive Programmers Group, Kaiserslautern March 31 2015
Be Reactive! at Functional and Reactive Programmers Group, Kaiserslautern March 31 2015
Go Reactive! Swisscom March 2015 37
Go Reactive! Swisscom March 2015
• We want to be asynchronous and non-blocking
• We need to ensure that our data is protected without locks
• We want to compose individual tasks into broader business logic
• Functional programming is critical to meeting these needs
• Declarative
• Immutable
• Referentially transparent
• Pure functions that only have inputs and outputs
38
Functional programming is key
Be Reactive! SUG KL March 2015
Where can I find that?
39
Be Reactive! SUG KL March 2015 40
Want to learn more?
http://www.typesafe.com
http://go.typesafe.com
Questions?
lutz.huehnken@typesafe.com
@lutzhuehnken on Twitter
1 of 40

Recommended

ReactJS + ReactNative = React Developer by
ReactJS + ReactNative = React DeveloperReactJS + ReactNative = React Developer
ReactJS + ReactNative = React Developer[T]echdencias
1.5K views37 slides
DDD, CQRS and testing with ASP.Net MVC by
DDD, CQRS and testing with ASP.Net MVCDDD, CQRS and testing with ASP.Net MVC
DDD, CQRS and testing with ASP.Net MVCAndy Butland
7.7K views49 slides
RxJS - The Reactive Extensions for JavaScript by
RxJS - The Reactive Extensions for JavaScriptRxJS - The Reactive Extensions for JavaScript
RxJS - The Reactive Extensions for JavaScriptViliam Elischer
1.9K views49 slides
Micro Services in .NET Core and Docker by
Micro Services in .NET Core and DockerMicro Services in .NET Core and Docker
Micro Services in .NET Core and Dockercjmyers
6.4K views17 slides
Go Reactive: Event-Driven, Scalable, Resilient & Responsive Systems by
Go Reactive: Event-Driven, Scalable, Resilient & Responsive SystemsGo Reactive: Event-Driven, Scalable, Resilient & Responsive Systems
Go Reactive: Event-Driven, Scalable, Resilient & Responsive SystemsJonas Bonér
30.9K views115 slides
Reactive programming with examples by
Reactive programming with examplesReactive programming with examples
Reactive programming with examplesPeter Lawrey
8.3K views32 slides

More Related Content

More from Lutz Hühnken

JVM Concurrency auf der JavaLand am 8. März 2016 by
JVM Concurrency auf der JavaLand am 8. März 2016JVM Concurrency auf der JavaLand am 8. März 2016
JVM Concurrency auf der JavaLand am 8. März 2016Lutz Hühnken
988 views63 slides
Building Applications with the Typesafe Reactive Platform at Skills Matter, L... by
Building Applications with the Typesafe Reactive Platform at Skills Matter, L...Building Applications with the Typesafe Reactive Platform at Skills Matter, L...
Building Applications with the Typesafe Reactive Platform at Skills Matter, L...Lutz Hühnken
479 views37 slides
JVM Concurrency on Devoxx at Nov 12 2015 by
JVM Concurrency on Devoxx at Nov 12 2015JVM Concurrency on Devoxx at Nov 12 2015
JVM Concurrency on Devoxx at Nov 12 2015Lutz Hühnken
1.4K views64 slides
Concurrency-Modelle auf der JVM auf der w-jax 3.11.2015 by
Concurrency-Modelle auf der JVM auf der w-jax 3.11.2015Concurrency-Modelle auf der JVM auf der w-jax 3.11.2015
Concurrency-Modelle auf der JVM auf der w-jax 3.11.2015Lutz Hühnken
1.4K views48 slides
Scala in Practice at Jazoon Tech Day, Oct 23 2015, Zurich by
Scala in Practice at Jazoon Tech Day, Oct 23 2015, ZurichScala in Practice at Jazoon Tech Day, Oct 23 2015, Zurich
Scala in Practice at Jazoon Tech Day, Oct 23 2015, ZurichLutz Hühnken
530 views53 slides
JVM Concurreny Models at code.talks, Hamburg, 30.9.2015 by
JVM Concurreny Models at code.talks, Hamburg, 30.9.2015JVM Concurreny Models at code.talks, Hamburg, 30.9.2015
JVM Concurreny Models at code.talks, Hamburg, 30.9.2015Lutz Hühnken
1.5K views46 slides

More from Lutz Hühnken(10)

JVM Concurrency auf der JavaLand am 8. März 2016 by Lutz Hühnken
JVM Concurrency auf der JavaLand am 8. März 2016JVM Concurrency auf der JavaLand am 8. März 2016
JVM Concurrency auf der JavaLand am 8. März 2016
Lutz Hühnken988 views
Building Applications with the Typesafe Reactive Platform at Skills Matter, L... by Lutz Hühnken
Building Applications with the Typesafe Reactive Platform at Skills Matter, L...Building Applications with the Typesafe Reactive Platform at Skills Matter, L...
Building Applications with the Typesafe Reactive Platform at Skills Matter, L...
Lutz Hühnken479 views
JVM Concurrency on Devoxx at Nov 12 2015 by Lutz Hühnken
JVM Concurrency on Devoxx at Nov 12 2015JVM Concurrency on Devoxx at Nov 12 2015
JVM Concurrency on Devoxx at Nov 12 2015
Lutz Hühnken1.4K views
Concurrency-Modelle auf der JVM auf der w-jax 3.11.2015 by Lutz Hühnken
Concurrency-Modelle auf der JVM auf der w-jax 3.11.2015Concurrency-Modelle auf der JVM auf der w-jax 3.11.2015
Concurrency-Modelle auf der JVM auf der w-jax 3.11.2015
Lutz Hühnken1.4K views
Scala in Practice at Jazoon Tech Day, Oct 23 2015, Zurich by Lutz Hühnken
Scala in Practice at Jazoon Tech Day, Oct 23 2015, ZurichScala in Practice at Jazoon Tech Day, Oct 23 2015, Zurich
Scala in Practice at Jazoon Tech Day, Oct 23 2015, Zurich
Lutz Hühnken530 views
JVM Concurreny Models at code.talks, Hamburg, 30.9.2015 by Lutz Hühnken
JVM Concurreny Models at code.talks, Hamburg, 30.9.2015JVM Concurreny Models at code.talks, Hamburg, 30.9.2015
JVM Concurreny Models at code.talks, Hamburg, 30.9.2015
Lutz Hühnken1.5K views
Scala.js at code.talks 2014, Hamburg by Lutz Hühnken
Scala.js at code.talks 2014, HamburgScala.js at code.talks 2014, Hamburg
Scala.js at code.talks 2014, Hamburg
Lutz Hühnken1K views
A Pragmatic View of Reactive by Lutz Hühnken
A Pragmatic View of ReactiveA Pragmatic View of Reactive
A Pragmatic View of Reactive
Lutz Hühnken8.9K views
Reactive Slick at Scala User Group Vienna May 20 2015 by Lutz Hühnken
Reactive Slick at Scala User Group Vienna May 20 2015Reactive Slick at Scala User Group Vienna May 20 2015
Reactive Slick at Scala User Group Vienna May 20 2015
Lutz Hühnken1.1K views
Von "Enterprise" zu "Reactive" (JAX 2015) by Lutz Hühnken
Von "Enterprise" zu "Reactive" (JAX 2015)Von "Enterprise" zu "Reactive" (JAX 2015)
Von "Enterprise" zu "Reactive" (JAX 2015)
Lutz Hühnken1.6K views

Recently uploaded

Tridens DevOps by
Tridens DevOpsTridens DevOps
Tridens DevOpsTridens
9 views28 slides
Advanced API Mocking Techniques by
Advanced API Mocking TechniquesAdvanced API Mocking Techniques
Advanced API Mocking TechniquesDimpy Adhikary
19 views11 slides
Upgrading Incident Management with Icinga - Icinga Camp Milan 2023 by
Upgrading Incident Management with Icinga - Icinga Camp Milan 2023Upgrading Incident Management with Icinga - Icinga Camp Milan 2023
Upgrading Incident Management with Icinga - Icinga Camp Milan 2023Icinga
38 views17 slides
BushraDBR: An Automatic Approach to Retrieving Duplicate Bug Reports by
BushraDBR: An Automatic Approach to Retrieving Duplicate Bug ReportsBushraDBR: An Automatic Approach to Retrieving Duplicate Bug Reports
BushraDBR: An Automatic Approach to Retrieving Duplicate Bug ReportsRa'Fat Al-Msie'deen
5 views49 slides
DSD-INT 2023 Delft3D FM Suite 2024.01 2D3D - New features + Improvements - Ge... by
DSD-INT 2023 Delft3D FM Suite 2024.01 2D3D - New features + Improvements - Ge...DSD-INT 2023 Delft3D FM Suite 2024.01 2D3D - New features + Improvements - Ge...
DSD-INT 2023 Delft3D FM Suite 2024.01 2D3D - New features + Improvements - Ge...Deltares
16 views12 slides
DSD-INT 2023 Modelling litter in the Yarra and Maribyrnong Rivers (Australia)... by
DSD-INT 2023 Modelling litter in the Yarra and Maribyrnong Rivers (Australia)...DSD-INT 2023 Modelling litter in the Yarra and Maribyrnong Rivers (Australia)...
DSD-INT 2023 Modelling litter in the Yarra and Maribyrnong Rivers (Australia)...Deltares
9 views34 slides

Recently uploaded(20)

Tridens DevOps by Tridens
Tridens DevOpsTridens DevOps
Tridens DevOps
Tridens9 views
Advanced API Mocking Techniques by Dimpy Adhikary
Advanced API Mocking TechniquesAdvanced API Mocking Techniques
Advanced API Mocking Techniques
Dimpy Adhikary19 views
Upgrading Incident Management with Icinga - Icinga Camp Milan 2023 by Icinga
Upgrading Incident Management with Icinga - Icinga Camp Milan 2023Upgrading Incident Management with Icinga - Icinga Camp Milan 2023
Upgrading Incident Management with Icinga - Icinga Camp Milan 2023
Icinga38 views
BushraDBR: An Automatic Approach to Retrieving Duplicate Bug Reports by Ra'Fat Al-Msie'deen
BushraDBR: An Automatic Approach to Retrieving Duplicate Bug ReportsBushraDBR: An Automatic Approach to Retrieving Duplicate Bug Reports
BushraDBR: An Automatic Approach to Retrieving Duplicate Bug Reports
DSD-INT 2023 Delft3D FM Suite 2024.01 2D3D - New features + Improvements - Ge... by Deltares
DSD-INT 2023 Delft3D FM Suite 2024.01 2D3D - New features + Improvements - Ge...DSD-INT 2023 Delft3D FM Suite 2024.01 2D3D - New features + Improvements - Ge...
DSD-INT 2023 Delft3D FM Suite 2024.01 2D3D - New features + Improvements - Ge...
Deltares16 views
DSD-INT 2023 Modelling litter in the Yarra and Maribyrnong Rivers (Australia)... by Deltares
DSD-INT 2023 Modelling litter in the Yarra and Maribyrnong Rivers (Australia)...DSD-INT 2023 Modelling litter in the Yarra and Maribyrnong Rivers (Australia)...
DSD-INT 2023 Modelling litter in the Yarra and Maribyrnong Rivers (Australia)...
Deltares9 views
What Can Employee Monitoring Software Do?​ by wAnywhere
What Can Employee Monitoring Software Do?​What Can Employee Monitoring Software Do?​
What Can Employee Monitoring Software Do?​
wAnywhere21 views
DSD-INT 2023 3D hydrodynamic modelling of microplastic transport in lakes - J... by Deltares
DSD-INT 2023 3D hydrodynamic modelling of microplastic transport in lakes - J...DSD-INT 2023 3D hydrodynamic modelling of microplastic transport in lakes - J...
DSD-INT 2023 3D hydrodynamic modelling of microplastic transport in lakes - J...
Deltares9 views
DSD-INT 2023 Thermobaricity in 3D DCSM-FM - taking pressure into account in t... by Deltares
DSD-INT 2023 Thermobaricity in 3D DCSM-FM - taking pressure into account in t...DSD-INT 2023 Thermobaricity in 3D DCSM-FM - taking pressure into account in t...
DSD-INT 2023 Thermobaricity in 3D DCSM-FM - taking pressure into account in t...
Deltares9 views
Elevate your SAP landscape's efficiency and performance with HCL Workload Aut... by HCLSoftware
Elevate your SAP landscape's efficiency and performance with HCL Workload Aut...Elevate your SAP landscape's efficiency and performance with HCL Workload Aut...
Elevate your SAP landscape's efficiency and performance with HCL Workload Aut...
HCLSoftware6 views
DSD-INT 2023 Baseline studies for Strategic Coastal protection for Long Islan... by Deltares
DSD-INT 2023 Baseline studies for Strategic Coastal protection for Long Islan...DSD-INT 2023 Baseline studies for Strategic Coastal protection for Long Islan...
DSD-INT 2023 Baseline studies for Strategic Coastal protection for Long Islan...
Deltares11 views
A first look at MariaDB 11.x features and ideas on how to use them by Federico Razzoli
A first look at MariaDB 11.x features and ideas on how to use themA first look at MariaDB 11.x features and ideas on how to use them
A first look at MariaDB 11.x features and ideas on how to use them
Federico Razzoli45 views
Dev-Cloud Conference 2023 - Continuous Deployment Showdown: Traditionelles CI... by Marc Müller
Dev-Cloud Conference 2023 - Continuous Deployment Showdown: Traditionelles CI...Dev-Cloud Conference 2023 - Continuous Deployment Showdown: Traditionelles CI...
Dev-Cloud Conference 2023 - Continuous Deployment Showdown: Traditionelles CI...
Marc Müller36 views
DSD-INT 2023 Dam break simulation in Derna (Libya) using HydroMT_SFINCS - Prida by Deltares
DSD-INT 2023 Dam break simulation in Derna (Libya) using HydroMT_SFINCS - PridaDSD-INT 2023 Dam break simulation in Derna (Libya) using HydroMT_SFINCS - Prida
DSD-INT 2023 Dam break simulation in Derna (Libya) using HydroMT_SFINCS - Prida
Deltares18 views
DSD-INT 2023 Simulating a falling apron in Delft3D 4 - Engineering Practice -... by Deltares
DSD-INT 2023 Simulating a falling apron in Delft3D 4 - Engineering Practice -...DSD-INT 2023 Simulating a falling apron in Delft3D 4 - Engineering Practice -...
DSD-INT 2023 Simulating a falling apron in Delft3D 4 - Engineering Practice -...
Deltares6 views
.NET Developer Conference 2023 - .NET Microservices mit Dapr – zu viel Abstra... by Marc Müller
.NET Developer Conference 2023 - .NET Microservices mit Dapr – zu viel Abstra....NET Developer Conference 2023 - .NET Microservices mit Dapr – zu viel Abstra...
.NET Developer Conference 2023 - .NET Microservices mit Dapr – zu viel Abstra...
Marc Müller38 views
Geospatial Synergy: Amplifying Efficiency with FME & Esri ft. Peak Guest Spea... by Safe Software
Geospatial Synergy: Amplifying Efficiency with FME & Esri ft. Peak Guest Spea...Geospatial Synergy: Amplifying Efficiency with FME & Esri ft. Peak Guest Spea...
Geospatial Synergy: Amplifying Efficiency with FME & Esri ft. Peak Guest Spea...
Safe Software412 views
DSD-INT 2023 Simulation of Coastal Hydrodynamics and Water Quality in Hong Ko... by Deltares
DSD-INT 2023 Simulation of Coastal Hydrodynamics and Water Quality in Hong Ko...DSD-INT 2023 Simulation of Coastal Hydrodynamics and Water Quality in Hong Ko...
DSD-INT 2023 Simulation of Coastal Hydrodynamics and Water Quality in Hong Ko...
Deltares11 views
Consulting for Data Monetization Maximizing the Profit Potential of Your Data... by Flexsin
Consulting for Data Monetization Maximizing the Profit Potential of Your Data...Consulting for Data Monetization Maximizing the Profit Potential of Your Data...
Consulting for Data Monetization Maximizing the Profit Potential of Your Data...
Flexsin 15 views

Be Reactive! at Functional and Reactive Programmers Group, Kaiserslautern March 31 2015

  • 7. Be Reactive! SUG KL March 2015 Elastic • Ability to scale, but also • be efficient, leverage modern multi- / many-core hardware • Scale up and down - Clusters need to support joining and leaving of nodes • To scale, every part must scale - no single point of failure, no contention 7
  • 8. Be Reactive! SUG KL March 2015 Resilient • Failure is embraced as a regular state in the system • Resilience is a first-class concept in your software • Failure is detected, isolated, and managed • Applications can recover from failure of parts (self-heal) 8
  • 9. Be Reactive! SUG KL March 2015 Before we get to message-driven • Let’s talk about • Multi-Threading • I/O • Distribution • Deployment 9
  • 10. Threads vs. task level concurrency
  • 11. Be Reactive! SUG KL March 2015 A supposedly great idea • Threads are • lightweight processes • easier programming model, no IPC 11
  • 12. Be Reactive! SUG KL March 2015 Lightweight? 12 Slide stolen from John Rose, Java VM Architect, JFokus, Stockholm, February 2015
  • 13. Be Reactive! SUG KL March 2015 The problem with Threads 13 They discard the most essential and appealing properties of sequential computation: understandability, predictability, and determinism. Threads, as a model of computation, are wildly nondeterministic, and the job of the programmer becomes one of pruning that nondeterminism.
  • 15. Be Reactive! SUG KL March 2015 Threads • not efficient • memory consumption • cost for context switch • shared memory bad for modern NUMA architectures • locks lead to contention
 • not a good programming model • shared mutual state is difficult to reason about 15
  • 16. Be Reactive! SUG KL March 2015 Tasks Better • task level (sub-thread) concurrency • share nothing approach • # threads ~ # of cores • Example: Actors, Play Actions 16
  • 18. Be Reactive! SUG KL March 2015 High concurrency matters 18 But there’s one thing we can all agree on: At high levels of concurrency (thousands of connections) your server needs to go to asynchronous non-blocking. [..] any part of your server code blocks you’re going to need a thread. And at these levels of concurrency, you can’t go creating threads for every connection. From https://strongloop.com/strongblog/node-js-is-faster-than-java/
  • 19. Be Reactive! SUG KL March 2015 Blocking I/O, Thread-per-request 19 From https://strongloop.com/strongblog/node-js-is-faster-than-java/
  • 20. Be Reactive! SUG KL March 2015 Non-blocking I/O 20 Note: Single Thread is crazy! What about your other cores?
  • 21. Be Reactive! SUG KL March 2015 Non-blocking 21 For task level (sub-thread level) concurrency • each thread is responsible for n tasks • and that n might be pretty big You don’t want to block such a thread with blocking I/O What if you must? Separate!
  • 23. Be Reactive! SUG KL March 2015 Life beyond Distributed Transactions 23 In general, application developers simply do not implement large scalable applications assuming distributed transactions. When they attempt to use distributed transactions, the projects founder because the performance costs and fragility make them impractical. [..] Instead, applications are built using different techniques which do not provide the same transactional guarantees but still meet the needs of their businesses.
  • 24. 24 Want Almost-Infinite Scaling
 • More of everything… Year by year, bigger and bigger • If it fits on your machines, multiply by 10, if that fits, multiply by 1000… • Strive to scale almost linearly (N log N for some big log). Assumptions
 (Don’t Have to Prove These… Just Plain Believe Them) Grown-Ups Don’t Use Distributed Transactions •The apps using distributed transactions become too fragile… • Let’s just consider local transactions. ! Multiple disjoint scopes of serializability Want Scale-Agnostic Apps
 • Two layers to the application: 
 scale-agnostic and scale-aware • Consider scale-agnostic API Scale Agnostic Code Scale-Aware-Code Application Upper Layer Lower Layer Scale Agnostic API
  • 25. Be Reactive! SUG KL March 2015 Distributed Transactions 25 Distributed Transactions („2PC“) are a source of unnecessary failure and of contention. It can usually be avoided. In the aforementioned paper by Pat Helland, he shows how to use local transactions and at-least-once delivery instead. The data storage landscape is changing, moving towards event sourcing and immutability. This is a great match for reactive systems.
  • 26. App Servers vs. Containerless
  • 27. Be Reactive! SUG KL March 2015 27
  • 28. Be Reactive! SUG KL March 2015 28
  • 29. Be Reactive! SUG KL March 2015 Java EE Application Servers 29 Servlet API was developed for thread-per-request, synchronous I/O. Application servers are not of much use anyway, nobody uses them as containers for multiple applications. Go containerless.
  • 31. Be Reactive! SUG KL March 2015 Checklist 31 If • Threads are the smallest unit of concurrency in your code, or • You use blocking I/O (without clear separation), or • You use 2-phase-commit across systems, or • You run in a Java EE Application Server Then your application is not reactive.
  • 32. Be Reactive! SUG KL March 2015 Want list 32 • Task-level (sub-thread level) concurrency • Non-blocking I/O • Distribution • Containerless Bonus: A simple, unified programming model
  • 33. .. gives you all that
  • 34. Be Reactive! SUG KL March 2015 Message-Driven • Loosely coupled architecture, easier to extend, maintain, evolve • Asynchronous and non-blocking • Concurrent by design, immutable state • Lower latency and higher throughput 34
  • 37. Go Reactive! Swisscom March 2015 37
  • 38. Go Reactive! Swisscom March 2015 • We want to be asynchronous and non-blocking • We need to ensure that our data is protected without locks • We want to compose individual tasks into broader business logic • Functional programming is critical to meeting these needs • Declarative • Immutable • Referentially transparent • Pure functions that only have inputs and outputs 38 Functional programming is key
  • 39. Be Reactive! SUG KL March 2015 Where can I find that? 39
  • 40. Be Reactive! SUG KL March 2015 40 Want to learn more? http://www.typesafe.com http://go.typesafe.com Questions? lutz.huehnken@typesafe.com @lutzhuehnken on Twitter