Disabling Undertow's request queuing during startup on EAP 7.2+
Environment
- Red Hat JBoss Enterprise Application Platform (EAP)
- 7.2.0+
Issue
- EAP 7 is queuing requests during startup. We'd prefer these to be immediately rejected during startup. Is this possible?
- JBoss EAP begins accepting traffic before all applications are deployed
- When we restart our JBoss cluster our Netscaler will detect the host is up and begin sending traffic to the node -- however, JBoss EAP is still deploying the application modules. We are looking for guidance on how we put a more robust readiness check in place so that we won't be flooded with traffic while deployments are still in progress.
- We need to consume webservices from example.war during JBoss EAP 7.1.6 instance startup, we already see that example.war is deployed first, but it can only be consumed until the instance has started.
Resolution
For EAP 7.2+, there are additional queue-requests-on-start and default-response-code attributes that can be specified on the undertow host, for example:
<host name="default-host" alias="localhost" queue-requests-on-start="false" default-response-code="503" >
This can be added using the following JBoss EAP CLI:
batch
/subsystem=undertow/server=default-server/host=default-host:write-attribute(name=queue-requests-on-start,value=false)
/subsystem=undertow/server=default-server/host=default-host:write-attribute(name=default-response-code,value=503)
run-batch
This would disable any request queuing during startup and provide immediate 503 responses instead until startup completes.
EAP 7.4 adds a new option to allow requests during start up again instead of queuing or rejecting with an error. See How to disable graceful startup and allow external invocations before JBoss EAP 7.4 is started
Root Cause
Listeners fully started before applications during start up on EAP 7.0 per Undertow listeners start before application deployments and start up is complete on EAP 7. This was addressed in 7.1 so that requests would be queued up instead. With 7.2, that queuing can be optionally disabled for immediate request failures during start up.
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.