a journey to reactive function programming
TRANSCRIPT
• CAT Reloaded Co-founder
• Life-long architect, software, and systems engineer.
• Focusing on systems reliability, scalability, and clean code.
Conictus
• The Internet had 1 billion users.
• Facebook had 5.5 million users.
• YouTube was a new born.
• Netflix had yet to introduce video streaming (2007)
https://medium.com/reactive-programming/what-is-reactive-programming-bc9fa7f4a7fc
• The internet has 2.95 billion users.
• Facebook has 1.393 billion monthly active users.
• YouTube has 1 billion users with 6 billions of hours of video/month.
• Twitter has 270 million users.
• Netflix has 57.4 million digital subscriber with 1 billion hours of video/month
• A set of ideas and principles to manage complexity in the world of highly responsive, asynchronous, scalable applications.
• The goal of reactive programming is to build responsive, flexible, and highly scalable applications without managing the complexity
• The system responds in a timely manner if at all possible.
• Responsive systems focus on providing rapid and consistent response times, establishing reliable upper bounds so they deliver a consistent quality of service.
Responsive
Responsiveness is the cornerstone of usability and utility, but more than that, responsiveness means that problems may be detected quickly and dealt with effectively.
Responsive in the face of failure!
This applies not only to highly-available, mission critical systems — any system that is not resilient will be unresponsive after a failure.
Resilient
• Recovery of each component is delegated to another (external) component and high-availability is ensured by replication where necessary.
PARTITIONING/SHARDING
Consistent HashingRouter
Bucket 1
Bucket 2
Bucket 100
Bucket 101
Machine 1
Machine (N)
msg
SHARE NOTHING
• Message-driven architectures are share-nothing by design.
• No shared mutable state between components.
• Avoid single-point-of-failures by partitioning+replication.
SCALE UP/DOWN AND OUT/INProcess 1
Process 2
MachineProcess 3
Process 4
…
Process 1
Process 2Server 1
Process 1
Process 2Server 1
Process 1
Process 2Server 1
LOCATION TRANSPARENCY
AuthService x = getAuthService(/* local or remote*/)x.sendMessage(new Login("asoliman", "password"))
• Abstraction over location of components enables you to scale out and up in the same way.
• The underlying message-passing system should handle all the plumbing and the optimization for the message delivery
• Foundation of scalable, resilient, and ultimately responsive systems.
• Immutable by design
• Loose Coupling
• Location Transparency
• Concurrency Control
• Everything is a stream of messages
Message-driven
• A programming language
• A framework/library/tool
• The only way to achieve concurrency and interactive applications
• Programming with functions where functions and data are treated the same way.
• A program is an evaluation of mathematical functions.
• Avoids mutable-data and changing-state.
function getEvens() { var x = 1; var result = []; while (x < 10) { if (x % 2 == 0) { result.push(x * 2); } } return result;}
scala> Stream.from(1) .takeWhile(x => x < 10) .filter(x => x % 2 == 0) .map(x => x * 2) .toListres2: List[Int] = List(4, 8, 12, 16)