<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div>
<div id="appendonsend"></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span>We made it work better by changing the worker configuration in JBoss like this.<br>
</span>
<div><br>
</div>
<div><worker name="default-undertow" io-threads="256" task-max-threads="2048" /><br>
</div>
<div><br>
</div>
<div><http-listener name="default" socket-binding="http" redirect-socket="https" worker="default-undertow" /><br>
</div>
<div><br>
</div>
<div>This looks like it could be a bit too much, but we can finetune that later.<br>
</div>
<div><br>
</div>
<div>We do not use mod_cluster, do you recommend us to setConnectionsPerThread on the proxy client?<br>
</div>
<div><br>
</div>
<span>Thanks for the help, Joakim. </span><br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span><br>
</span></div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>Från:</b> undertow-dev-bounces@lists.jboss.org <undertow-dev-bounces@lists.jboss.org> för Carter Kozak <ckozak@ckozak.net><br>
<b>Skickat:</b> den 13 februari 2019 14:16<br>
<b>Till:</b> undertow-dev@lists.jboss.org<br>
<b>Ämne:</b> Re: [undertow-dev] ProxyHandler returns 503 under load</font>
<div> </div>
</div>
<div>
<div>When the connections-per-thread limit is reached, requests result in 503 responses. Is the problem resolved by increasing the connections-per-thread value to 50 or 100?<br>
</div>
<div><br>
</div>
<div>On Wed, Feb 13, 2019, at 04:42, Jocke Eriksson wrote:<br>
</div>
<blockquote type="cite" id="x_fastmail-quoted">
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Hello,<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
We are trying to build an API gateway using undertow as a servlet extension, this has been working great until we started our performance tests.<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Our setup is two gateways balancing traffic towards 10+ servers and we are using JBoss EAP 7.0 We have observed that some of our requests fail with 503 response. When we get a 503 response from a request, we have also observed that it never reaches the proxy
target.<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
I made a small test on my machine to see if I could get the same error, to my surprise this was very easy. First I tried with the following code.<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<div><span>public class ApiGatewayServletExtension implements ServletExtension {<br>
</span></div>
<div><br>
</div>
<div> @Override<br>
</div>
<div> public void handleDeployment(DeploymentInfo deploymentInfo, ServletContext servletContext) {<br>
</div>
<div> LOG.info("Deploying {}...", MethodHandles.lookup().lookupClass().getSimpleName());<br>
</div>
<div> deploymentInfo.addInitialHandlerChainWrapper(handler -> {<br>
</div>
<div> try {<br>
</div>
<div> LoadBalancingProxyClient loadBalancer = new LoadBalancingProxyClient()<br>
</div>
<div> .addHost(new URI("http://localhost:8282"))<br>
</div>
<div> .setConnectionsPerThread(20);<br>
</div>
<div> return new ProxyHandler(loadBalancer, 30000, handler);<br>
</div>
<div> } catch (URISyntaxException ex) {<br>
</div>
<div> throw new IllegalStateException(ex);<br>
</div>
<div> }<br>
</div>
<div> });<br>
</div>
<div> }<br>
</div>
<div><span>}</span><br>
</div>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
I used JMeter with 20 threads making a simple rest GET request and after 30 seconds or so the test stopped with a 503 response.<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Then I created a small java application using undertow 2.0.17.Final like this.<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<div><span> public static void main(final String[] args) {<br>
</span></div>
<div><br>
</div>
<div> try {<br>
</div>
<div> LoadBalancingProxyClient loadBalancer = new LoadBalancingProxyClient()<br>
</div>
<div> .addHost(new URI("http://localhost:8282"))<br>
</div>
<div> .setConnectionsPerThread(20);<br>
</div>
<div> ProxyHandler proxyHandler = new ProxyHandler(loadBalancer, 30000, ResponseCodeHandler.HANDLE_404);<br>
</div>
<div><br>
</div>
<div> Undertow server = Undertow.builder()<br>
</div>
<div> .addHttpListener(8080, "localhost")<br>
</div>
<div> .setHandler(proxyHandler).build();<br>
</div>
<div> <br>
</div>
<div> server.start();<br>
</div>
<div><br>
</div>
<div> } catch (Exception ex) {<br>
</div>
<div> System.out.println(ex.getMessage());<br>
</div>
<div> }<br>
</div>
<div><span> }</span><br>
</div>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span></span><br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span>Getting the same result. I have also tried just loading the home page of one of our servers and still the same result.</span><br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span></span><br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span>Any help would be very much appreciated. I have not created a bug because I'm pretty sure we are just missing something here.</span><br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span></span><br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span>Regards Joakim Eriksson. </span><br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div>_______________________________________________<br>
</div>
<div>undertow-dev mailing list<br>
</div>
<div>undertow-dev@lists.jboss.org<br>
</div>
<div>https://lists.jboss.org/mailman/listinfo/undertow-dev<br>
</div>
</blockquote>
<div><br>
</div>
</div>
</div>
</body>
</html>