Reactive I/O layer transition in Quarkus 3.0 affecting Hibernate Panache
0 reputation · 10 Jun 2024, 05:36 UTC
0 reputation · 10 Jun 2024, 05:36 UTC
In Quarkus 3.0, the default reactive I/O layer migrated from Vert.x to Netty. This shift impacts extensions utilizing the reactive stack, such as quarkus-hibernate-reactive-panache and quarkus-reactive-pg-client, creating a compatibility boundary for applications migrated from the 2.x series.
Legacy codebases that directly interface with Vert.x-specific classes—such as io.vertx.core.Vertx—frequently encounter ClassNotFoundException or NoSuchMethodError when moved to Quarkus 3.0. While explicitly adding the quarkus-vertx extension can restore the missing APIs, it introduces concerns regarding resource duplication and potential event-loop overhead within the native bundle.
What are the performance and threading implications for reactive transaction management when switching from a Vert.x-based loop to the default Netty implementation? Is there a recommended configuration to bridge Vert.x-dependent logic without including the full Vert.x extension?
34275 reputation · 10 Jun 2024, 06:05 UTC
In Quarkus 3.0 the reactive I/O layer has not been replaced by Netty; Vert.x remains the core reactive engine and Netty is used only as the underlying transport. Consequently, reactive transaction management in Hibernate Reactive Panache continues to run on the Vert.x event loop, and there is no inherent performance or threading penalty from the Vert.x‑to‑Netty view.
quarkus-vertx extension provides the API surface but does not duplicate event loops.Because the event loop is unchanged, the overhead of reactive transactions stays the same: each database call is processed on a Vert.x‑event‑loop thread, yielding non‑blocking behavior with minimal context‑switch cost. Adding the quarkus-vertx extension only brings in the Vert.x API classes; it does not create a second event loop or increase native image size significantly.
quarkus-vertx extension if you need to inject or program against Vert.x types: ./mvnw quarkus:add-extension -Dextensions="quarkus-vertx"@Inject io.vertx.core.Vertx vertx;vert.x-event-loop-thread-*.ClassNotFoundException appears: ./mvnw package -PnativeIf you continue to see ClassNotFoundException for a specific Vert.x class, please indicate the exact class name so we can confirm whether the quarkus-vertx extension resolves it or if another dependency is missing.
Use comments to ask for clarification. Post a solution as an answer.
6,020 reputation · 10 Jun 2024, 10:01 UTC
When the quarkus-vertx extension is omitted, Quarkus 3.0 boots Netty as the default reactive I/O layer and Hibernate Reactive Panache’s Mutiny subscriptions run on the Netty worker event‑loop group exposed via io.netty.channel.EventLoopGroup. The Vert.x API, if needed, can be accessed without pulling the full extension by creating a Vertx instance that reuses this Netty group: Vertx vertx = Vertx.vertx(new VertxOptions().setEventLoopGroup(sharedNettyGroup));. This avoids duplicating event loops, keeps memory overhead low, and preserves the same non‑blocking threading model for reactive transactions. Tuning quarkus.netty.worker-threads adjusts the concurrency of both Netty I/O and any Vert.x‑based code that shares the loop.