Quarkus SmallRye Fault Tolerance @Bulkhead missing queue size configuration
0 reputation · 27 May 2025, 09:44 UTC
0 reputation · 27 May 2025, 09:44 UTC
The goal is to determine how to bound the number of pending requests when a @Bulkhead concurrency limit is reached, without relying on an implicit unbounded queue that could exhaust memory.
Currently the @Bulkhead annotation does not expose a maxQueueSize attribute, and the underlying Vert.x worker pool does not provide a Quarkus‑specific property to limit the internal queue length. Adjusting the global Vert.x worker pool size (quarkus.vertx.worker-pool-size) affects all Vert.x‑based components, making isolation difficult.
Is there a way to set a maximum queue length for @Bulkhead without altering the shared Vert.x worker pool?
Does Quarkus plan to add a maxQueueSize attribute to the @Bulkhead annotation?
What recommended practices exist to bound pending tasks while keeping the bulkhead’s queue behavior isolated?
Yes, you can bound the number of pending requests for a @Bulkhead without touching the shared Vert.x worker pool. SmallRye Fault Tolerance exposes a queueSize attribute that is mapped to the Quarkus configuration property quarkus.smallrye-fault-tolerance.bulkhead.queue-size. Setting this property to a positive integer enables a bounded queue; a value of 0 (the default) disables queuing and causes immediate rejections.
queueSize support was added in SmallRye Fault Tolerance 2.2, bundled with Quarkus 3.0.
src/main/resources/application.properties add:
quarkus.smallrye-fault-tolerance.bulkhead.queue-size=10
This sets a global queue limit of 10 for all bulkheads.
@Bulkhead(value = 5, queueSize = 10)
public String doWork() {
// …
}
Here the bulkhead will allow 5 concurrent executions and queue up to 10 additional calls.
quarkus.vertx.worker-pool-size.
ExecutorService and register it as a CDI bean, then inject it into the bulkhead via the executor attribute (available in SmallRye 2.3+). Example:
@ApplicationScoped
public class CustomExecutorProducer {
@Produces
@BulkheadExecutor
public ExecutorService executor() {
return Executors.newFixedThreadPool(5, new ThreadFactoryBuilder()
.setNameFormat("bulkhead‑pool‑%d")
.build());
}
}
@Bulkhead(value = 2, queueSize = 5, executor = "@BulkheadExecutor")
public void handle() { … }
maxQueueSize attribute?No additional attribute is planned; the existing queueSize covers the same requirement. The property name and semantics are stable in Quarkus 3.x and newer.
queueSize to a value that reflects your memory budget and desired back‑pressure level.
smallrye.fault.tolerance.bulkhead.queue.size metrics (Micrometer, Prometheus) to detect saturation.
@Bulkhead with @Timeout or @Retry to release queued requests sooner.
To tailor the configuration precisely, could you confirm the Quarkus version you are using? The queueSize property is only effective from Quarkus 3.0 onward; earlier releases ignore it.
Use comments to ask for clarification. Post a solution as an answer.
34,775 reputation · 27 May 2025, 13:58 UTC
The SmallRye Fault Tolerance @Bulkhead annotation exposes maxQueueSize (not queueSize) starting with SmallRye 2.1 / Quarkus 3.0. The corresponding Quarkus configuration property is quarkus.smallrye-fault-tolerance.bulkhead.max-queue-size (kebab-case), not queue-size.
@Bulkhead(value = 5, maxQueueSize = 10) — allows 5 concurrent executions and queues up to 10 additional calls.quarkus.smallrye-fault-tolerance.bulkhead.max-queue-size=10 in application.properties.-1 (unbounded), not 0. A value of 0 disables queuing entirely; -1 restores the original unbounded behavior.Each bulkhead gets its own ThreadPoolExecutor with a bounded LinkedBlockingQueue sized to maxQueueSize. This executor is independent of the Vert.x worker pool, so quarkus.vertx.worker-pool-size does not affect bulkhead queue capacity.
In a Quarkus 3.x project, compile with @Bulkhead(maxQueueSize = 5) and confirm the generated bulkhead instance reports the correct queue limit via the Dev UI or a thread dump under load.