As engineers we want to build systems that are valuable for the consumers; a reactive system strives to provide a correct answer in a timely manner to its users whether they are humans or other systems. For this reason a fundamental quality of such systems is responsiveness.
A responsive system establishes the upper bounds for acceptable latency. Latency is the time that passes between a request and the response. Predictable latency and correct answers provide confidence on the system, help error handling and enforce further system usage. To design a responsive system we could work and three main aspects: resiliency, concurrency and elasticity.
It is really frustrating when a system gets stuck in an inconsistent state caused by a failure; that system lacks a stable design with the direct consequence of not being responsive. We have to design a system that could keep working through failures adding redundancy, isolating the components to avoid cascading effects and when everything else fails restarting part of it without affecting the whole. This would free the user of the components from the handling of failures. To achieve this level of separation we could design concurrent systems.
Reactive systems achieve concurrency and isolation through asynchronous message passing, this enforces decoupling and modularisation simplifying logging and monitoring. Failures itself could be handled through delegation using messaging. Message passing promotes a better and clearer separation of concerns where a message would specify what to do and a message handler would take care of how to do it. All of this properties enable elasticity using queues to mitigate spikes in system load.
An elastic system provides a consistent latency dynamically allocating resources as the need arises and optimising their usage when the system faces less pressure. Queues and independent components enable horizontal scalability providing a more consistent and manageable latency reducing bottlenecks and allowing replication.
The actor model started as an attempt at defining an abstraction to describe efficiently and expressively the problem of concurrently cooperative execution of desired actions when it became evident that the future of computing would be distributed and parallel. Actors are units of computations that communicate asynchronously through messages; their very nature is highly concurrent enabling parallel problem solving.
The reactive model requires good modularisation so that the actors responsible to handle their messages can execute their domain behaviour effectively and concurrently. This is easier to achieve when there is no shared mutable state between them. This is the reason why functional programming is a perfect fit; referential transparency and modularisation are encouraged from the very beginning and at every level. Using pure functions and immutable data structures that decouple side effects from pure logic enable scalability, concurrency and composability.
Software es nuestra pasión.
Somos Software Craftspeople. Construimos software bien elaborado para nuestros clientes, ayudamos a los/as desarrolladores/as a mejorar en su oficio a través de la formación, la orientación y la tutoría. Ayudamos a las empresas a mejorar en la distribución de software.