Distributed systems tend to be built either with synchronous remote procedure calls or using fully asynchronous message passing. The message passing approach offers a number of benefits:
- systems can be more cleanly composed; it is simpler to construct a system out of loosely coupled components which operate asynchronously than it is to build a system in which every component must be running and responsive for the system to function correctly.
- message passing based designs can offer location transparency. If the primary component for processing a message fails, then a backup component can pick up and process the message without any knowledge of the sender. All that a component needs to do is consume messages from known endpoints, and to emit messages to one or more endpoints. With RPC HTTP based systems you're typically either hitting services directly, or a previously known load balancer or API gateway.
- message passing designs tend to treat failures as just another type of message. If something failed, a message is emitted, and every service which needs to know about that can receive the message as needed
- it is simpler to implement and manage advanced capacity management capabilities - such as flow control, back pressure and service elasticity in message based systems
- finally, systems built with asynchronous message passing tend to consume less resources, resulting in lower overhead.
Agrona and Aeron enable developers to build reactive systems built with message passing. You can easily take the message passing based approach all the way from Agrona's RingBuffer implementations all the way to large scale multicast with Aeron and Aeron Archive and on to fault tolerant services with Aeron Cluster. The overall approach to writing the business logic remains consistent — you react to an inbound message and produce zero or more outbound messages.