Streaming or real-time systems

Another useful application of WebFlux is with real-time and streaming systems. To understand why WebFlux helps here, let's remind ourselves what real-time and streaming systems are.

First of all, these systems are characterized by low latency and high throughput. For streaming systems, most of the data is outgoing from the server side, so the client side plays the role of a consumer. It is usual for there to be fewer events from the client side than from the server side. However, for real-time systems such as online games, the amount of incoming data is equal to the amount of outgoing data.

Low latency and high throughput can be achieved by using non-blocking communication. As we learned from the previous sections, non-blocking, asynchronous communication allows for efficient resource utilization. The highest throughput and lowest latency were shown by systems based on Netty or similar frameworks. However, such reactive frameworks have their own drawbacks, which are complicated interaction models that use channels and callbacks.

Despite this, reactive programming is an elegant solution for both of these issues. As we learned in Chapter 4Project Reactor - the Foundation for Reactive Apps, reactive programming, especially with reactive libraries such as Reactor 3, helps us build an asynchronous, non-blocking flow with only a small overhead from the underlying code base complexity and an acceptable learning curve. Both solutions are incorporated into WebFlux. Using Spring Framework allows us to build such a system easily.

..................Content has been hidden....................

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