A thread pool thread is a worker thread assigned to handle a request, including its blocking or computational work. In imperative execution, each incoming request receives a thread from a predefined pool and keeps it until completion. section 8.1.1
Blocking I/O makes the worker thread wait while a database, filesystem, network service, or message broker responds. During that wait, the thread performs no other work, consuming memory and CPU capacity as concurrency grows. section 8.1.1 section 7.7
Reactive Quarkus applications reserve event-loop threads for nonblocking work and move blocking operations to worker threads. After the blocking operation finishes, execution can return to the event loop. section 8.1.1 section 7.7
Quarkus selects the execution thread using the endpoint’s behavior:
- Return a Uni to run the method on the nonblocking I/O thread; do not block that thread. section 8.4.1
- Use @Blocking to run a method on a worker or executor thread when its work may block. section 8.4.1
- Use @NonBlocking to select nonblocking execution for a method that does not return Mutiny types. section 8.4.1
Blocking persistence
Traditional Hibernate ORM performs blocking database access, so Quarkus delegates that operation to a worker thread rather than blocking the event loop. Hibernate Reactive and reactive database drivers generally avoid that delegation through reactive APIs. section 7.7
Figure 8.1 Blocking I/O request handling: threads are blocked while waiting for an I/O operation to complete
Compare request handling that holds worker threads during I/O with event-driven handling that keeps a small set of event-loop threads available. section 8.1.1
