Microservice-based systems

WebFlux's first obvious application is in microservice systems. The most distinctive feature of typical microservice systems compared to monoliths is the abundance of I/O communication. The presence of I/O, especially blocking I/O, decreases the overall system latency and throughput. Contention and coherence in the thread-per-connection model do not improve system performance significantly. This means that for systems or particular services where inter-service calls are important, WebFlux will be one of the most efficient solutions. An example of such a service is a payment flow orchestration service.

Usually, behind a simple operation, such as money transferring between accounts, there is a hidden, intricate mechanism, which includes a set of retrievals, verifications, and then the actual transfer execution operations. For example, when we send money using PayPal, the first step may be to retrieve the accounts of the sender and the recipient. Then, since PayPal can transfer money from any country to any country, it is important to verify that the transfer will not break the laws of those countries. Each account may have its own limitations and restrictions. Finally, the recipient may have either an internal PayPal account or an external credit or debit card so, depending on the account type, we may have to make an additional call to an external system:

Diagram 6.25. An example implementation of the PayPal payment flow

By configuring non-blocking, asynchronous communication in such a complex flow, we may efficiently process other requests and efficiently utilize computer resources.

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

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