Advantages of the synchronous model

Even though synchronous data access is not the most efficient way of spending server resources when implementing a persistence layer, it is still a highly valuable approach, primarily when used for building blocking web applications. JDBC, while probably being the most popular and versatile API for accessing data, almost entirely hides the complexity of client-server communications between an application and a database. Spring Data JDBC and Spring Data JPA give even more high-level instruments for data persistence, hiding the tremendous complexity of query translation and transaction management. All of this is battle-tested and considerably simplifies the way in which modern applications have developed.

The synchronous data access is simple, easy to debug, and easy to test. It is also easy to track resource usage by monitoring thread pools. The synchronous approach provides a massive set of instruments (such as JPA and Spring Data connectors) that do not require any backpressure support and still may be efficient when using iterators and synchronous streams. Moreover, most modern databases internally use a blocking model, so it is natural to use blocking drivers for interactions. This synchronous approach has excellent support for local and distributed transactions. It is also easy to implement a wrapper over a native driver written in C or C++.

The only downside of synchronous data access lies in the blocking manner of execution, which is poorly compatible with reactive web applications built with the reactive paradigm (Netty, Reactor, WebFlux).

After a short recap of synchronous data access techniques, we may move towards the exploration of reactive data persistence and see how Spring Data's reactive connectors fulfill the promise of high performance without compromising the versatility of Spring Data repositories.

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

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