Skip to Content
Reactive Systems in Java
book

Reactive Systems in Java

by Clement Escoffier, Ken Finnigan
November 2021
Intermediate to advanced
296 pages
7h 17m
English
O'Reilly Media, Inc.
Book available
Content preview from Reactive Systems in Java

Chapter 9. Accessing Data Reactively

In Chapter 5, we explained the scalability and robustness problems in the use of blocking I/O for applications. This chapter focuses on interacting with databases and how Quarkus ensures that the data layers of an application stack can be asynchronous and utilize nonblocking I/O too.

The Problem with Data Access

Accessing relational data previously involved blocking I/O while communicating with a database. As already discussed in Chapter 5, we want to avoid blocking I/O in our applications, at any level of the stack. Interacting with a database often takes a non-trivial amount of time to complete, depending on the number of records involved, creating an even larger impact on our application with blocking I/O to access a database! What do we mean by this? Let’s say we’ve developed a small database application; we’ve all developed many of those over the years. We often refer to them as CRUD applications because they provide create, read, update, and delete operations for records in a database.

Every exposed endpoint in our API needs to interact with the database. We will ignore caches and how they reduce the number of requests made to a database in certain situations. With each endpoint method calling the database, every execution performs blocking I/O, reducing concurrency.

Why are we forced to use blocking I/O when interacting with databases? APIs for interacting with databases, such as Open Database Connectivity (ODBC) and Java Database Connectivity ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Java 8 in Action

Java 8 in Action

Mario Fusco, Alan Mycroft, Raoul-Gabriel Urma
Java Concurrency in Practice

Java Concurrency in Practice

Brian Goetz, Tim Peierls, Joshua Bloch, Joseph Bowbeer, David Holmes, Doug Lea

Publisher Resources

ISBN: 9781492091714Errata PageSupplemental Content