Abstract:
Reactive applications need to be able to respond to demand, be elastic and ready to scale up, down, in and out—taking full advantage of mobile, multi-core and cloud computing architectures—in real time.
In this talk we will discuss the guiding principles making this possible through the use of share-nothing and non-blocking designs, applied all the way down the stack. We will learn how to deliver systems that provide reactive supply to changing demand.
I gave this talk at React Conf 2014 in London. Recording available here: https://www.youtube.com/watch?v=mBFdj7w4aFA
8. 5
Yesterday Today
Single machines Clusters of machines
Single core processors
9. 5
Yesterday Today
Single machines Clusters of machines
Single core processors Multicore processors
10. 5
Yesterday Today
Single machines Clusters of machines
Single core processors Multicore processors
Expensive RAM
11. 5
Yesterday Today
Single machines Clusters of machines
Single core processors Multicore processors
Expensive RAM Cheap RAM
12. 5
Yesterday Today
Single machines Clusters of machines
Single core processors Multicore processors
Expensive RAM Cheap RAM
Expensive disk
13. 5
Yesterday Today
Single machines Clusters of machines
Single core processors Multicore processors
Expensive RAM Cheap RAM
Expensive disk Cheap disk
14. 5
Yesterday Today
Single machines Clusters of machines
Single core processors Multicore processors
Expensive RAM Cheap RAM
Expensive disk Cheap disk
Slow networks
15. 5
Yesterday Today
Single machines Clusters of machines
Single core processors Multicore processors
Expensive RAM Cheap RAM
Expensive disk Cheap disk
Slow networks Fast networks
16. 5
Yesterday Today
Single machines Clusters of machines
Single core processors Multicore processors
Expensive RAM Cheap RAM
Expensive disk Cheap disk
Slow networks Fast networks
Few concurrent users
17. 5
Yesterday Today
Single machines Clusters of machines
Single core processors Multicore processors
Expensive RAM Cheap RAM
Expensive disk Cheap disk
Slow networks Fast networks
Few concurrent users Lots of concurrent users
18. 5
Yesterday Today
Single machines Clusters of machines
Single core processors Multicore processors
Expensive RAM Cheap RAM
Expensive disk Cheap disk
Slow networks Fast networks
Few concurrent users Lots of concurrent users
Small data sets
19. 5
Yesterday Today
Single machines Clusters of machines
Single core processors Multicore processors
Expensive RAM Cheap RAM
Expensive disk Cheap disk
Slow networks Fast networks
Few concurrent users Lots of concurrent users
Small data sets Large data sets
20. 5
Yesterday Today
Single machines Clusters of machines
Single core processors Multicore processors
Expensive RAM Cheap RAM
Expensive disk Cheap disk
Slow networks Fast networks
Few concurrent users Lots of concurrent users
Small data sets Large data sets
Latency in seconds
21. 5
Yesterday Today
Single machines Clusters of machines
Single core processors Multicore processors
Expensive RAM Cheap RAM
Expensive disk Cheap disk
Slow networks Fast networks
Few concurrent users Lots of concurrent users
Small data sets Large data sets
Latency in seconds Latency in milliseconds
30. 12
“Capable of being easily expanded or upgraded on demand”
- Merriam Webster Dictionary
31. 13
“The house in which Amdahl wakes up very early each day and
rules with an iron fist.”
- Martin Thompson (originally Gil Tene)
32. 13
“The house in which Amdahl wakes up very early each day and
rules with an iron fist.”
- Martin Thompson (originally Gil Tene)
33. 14
“A service is said to be scalable if when we increase the
resources in a system, it results in increased performance
in a manner proportional to resources added.”
- Werner Vogels
61. The Role of Immutable State
• Great to represent facts
• Messages and Events
• Database snapshots
• Representing the succession of time
30
62. The Role of Immutable State
• Great to represent facts
• Messages and Events
• Database snapshots
• Representing the succession of time
• Mutable State is ok if local and contained
• Allows Single-threaded processing
• Allows single writer principle
• Feels more natural
• Publish the results to the world as Immutable State
30
67. • Mobile
• Cloud Services, REST etc.
• NOSQL DBs
• Big Data
• etc
34
Distributed Computing is the new normal
68. What is the essence of
distributed computing?
35
To try to overcome that
69. What is the essence of
distributed computing?
1. Information travels at the speed of light
2. Independent things fail independently
35
To try to overcome that
74. 1. The network is reliable
2. Latency is zero
3. Bandwidth is infinite
4. The network is secure
5. Topology doesn't change
6. There is one administrator
7. Transport cost is zero
8. The network is homogeneous
37
Peter Deutsch’s
8 Fallacies of
Distributed
Computing
75. The Graveyard of Distributed Systems
• Distributed Shared Mutable State
• ⇒ EVIL (where N is number of nodes)
• Serializable Distributed Transactions
• Synchronous RPC
• Guaranteed Delivery
• Distributed Objects
• “Sucks like an inverted hurricane” - Martin Fowler
38
N
78. 41
Linearizability
“Under linearizable consistency, all operations appear to have
executed atomically in an order that is consistent with the
global real-time ordering of operations.”
- Herlihy & Wing 1991
85. Life beyond Distributed Transactions:
47
an Apostate’s Opinion
“In general, application developers simply do not
implement large scalable applications assuming
distributed transactions.”
-‐
Pat Helland
86. 48
Domain Events
“State transitions are an important part of our problem
space and should be modeled within our domain.”
- Greg Young
87. 49
The Event Log
"The database is a cache of a subset of the log.”
- Pat Helland
88. The Event Log
• Append-Only Logging
• Database of Facts
• Two models:
• One single Event Log
• Strong Consistency
• Multiple sharded Event Logs
• Strong + Eventual Consistency
50
95. CPU
L1/CPU
L2
Cache
Core
CPU
CPU
L1/CPU
L2
Cache
Core
Socket
ThreTahreadd CPUCPU CPU
MachMiacnhinee NodNeode ClustCleusterr JVMJVM Data
Center
55
Data
Socket
Center