RSocket for low-latency, reactive message passing

In the previous section, we learned how we might achieve a reactive system easily using Spring Cloud Streams and its variant in Spring Cloud Data Flow. In turn, we learned how to build a fine-grained system using lightweight functions with the support of Spring Cloud Function and the simplicity of composing them into the flow.

However, one disadvantage of such simplicity and flexibility is losing a low-latency approach. Nowadays, there are some areas of applications where each millisecond plays a vital role. For example, with the stock exchange market, online video games, or systems of real-time manufacture control. With such systems, it is unacceptable to waste time on queuing and dequeuing messages. In turn, as may be noticed, most reliable message brokers persist a message, which increases the time it takes to deliver a message.

One of the possible solutions to achieve low-latency communication between services in a distributed system is by using a continuous direct connection between services. For example, when wiring continuous TCP connections between applications, we can achieve direct communication between services with lower latency and some delivery guarantees, depending on the given transport. Along with that, the usage of broader known protocols such as WebSocket allows the building of such communication using Spring WebFlux's ReactorNettyWebSocketClient, for instance.

However, as we might remember from earlier in this chapter, along with a tight coupling between services (because of the connection), the usage of WebSockets does not fit the reactive system requirements, since the protocol does not offer the possibility to control backpressure, which is a vital part of a resilient system.

Fortunately, the group behind the reactive streams specification understood the necessity of cross-network, asynchronous, low-latency communication. In mid 2015, Ben Christensen initiated a new project called RSocket with a group of experts.

The central goal of the RSocket project is to provide an application protocol with reactive streams' semantics over an asynchronous, binary boundary.

To learn more about the motivation for creating the RSocket project, please visit the following link: https://github.com/rsocket/rsocket/blob/master/Motivations.md.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.141.35.185