Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UNDERTOW-1204 mod_cluster proxy: set default value of cacheConnections (smax) to 1 #569

Merged
merged 1 commit into from Oct 24, 2017
Merged

UNDERTOW-1204 mod_cluster proxy: set default value of cacheConnections (smax) to 1 #569

merged 1 commit into from Oct 24, 2017

Conversation

frapex
Copy link
Contributor

@frapex frapex commented Oct 23, 2017

The default value of cacheConnections (smax) is currently set to 8. This is the number of idle connections that will be kept alive per IO thread. ioThreads is set to the number of available processors with a minimum of 2 (Undertow.java).

These idle connections unnecessarily consume cpu, memory and network resources. This becomes a big issue in large scale environments with over 4100 backend servers (4100 (backend servers) * 8 (conns) * 2 (iothreads) = 65600 idle connections, TCP stack only supports up to 65535 ports).

By setting the default value of cacheConnections (smax) to 1, idle connections timeout when they reach their ttl, not before. There is no performance impact. The default value can still be overriden client-side by setting smax in the mod_cluster configuration.

@undertow-pull-request
Copy link

Windows Build 2222 outcome was FAILURE using a merge of 8d50105
Summary: Tests failed: 1, passed: 2970, ignored: 613 Build time: 00:38:20

Failed tests

io.undertow.server.handlers.ReceiverTestCase.testAsyncReceiveWholeBytesFailed[proxy][http2]: java.lang.AssertionError
	at io.undertow.server.handlers.ReceiverTestCase.testAsyncReceiveWholeBytesFailed(ReceiverTestCase.java:194)
------- Stderr: -------
08:30:46,574 DEBUG (XNIO-1 I/O-4) [io.undertow.server.handlers.proxy] <ProxyHandler.java:531> Sending request ClientRequest{path='/fullbytes', method=POST, protocol=HTTP/1.1} to target localhost/127.0.0.1:8888 for exchange HttpServerExchange{ POST /fullbytes request {Content-Length=[130000100], Host=[localhost]} response {}}
08:30:46,577 DEBUG (XNIO-1 I/O-4) [io.undertow.server.handlers.proxy] <ProxyHandler.java:548> Sent request ClientRequest{path='/fullbytes', method=POST, protocol=HTTP/1.1} to target 127.0.0.1 for exchange HttpServerExchange{ POST /fullbytes request {Content-Length=[130000100], Host=[localhost]} response {}}
08:30:46,824 ERROR (XNIO-1 I/O-4) [io.undertow.proxy] <ProxyHandler.java:644> UT005028: Proxy request to /fullbytes failed: java.nio.channels.ClosedChannelException
	at io.undertow.client.http2.Http2ClientConnection$1.handleEvent(Http2ClientConnection.java:108)
	at io.undertow.client.http2.Http2ClientConnection$1.handleEvent(Http2ClientConnection.java:100)
	at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
	at io.undertow.server.protocol.framed.AbstractFramedChannel$FrameCloseListener.handleEvent(AbstractFramedChannel.java:1034)
	at io.undertow.server.protocol.framed.AbstractFramedChannel$FrameCloseListener.handleEvent(AbstractFramedChannel.java:948)
	at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
	at io.undertow.protocols.ssl.SslConduit$SslReadReadyHandler.terminated(SslConduit.java:1186)
	at org.xnio.nio.NioSocketConduit.readTerminated(NioSocketConduit.java:360)
	at org.xnio.nio.NioSocketStreamConnection.notifyReadClosed(NioSocketStreamConnection.java:148)
	at org.xnio.Connection.close(Connection.java:139)
	at org.xnio.IoUtils.safeClose(IoUtils.java:134)
	at io.undertow.protocols.ssl.SslConduit.closed(SslConduit.java:1021)
	at io.undertow.protocols.ssl.SslConduit.close(SslConduit.java:1092)
	at io.undertow.protocols.ssl.UndertowSslConnection.closeAction(UndertowSslConnection.java:149)
	at org.xnio.Connection.close(Connection.java:132)
	at org.xnio.IoUtils.safeClose(IoUtils.java:134)
	at io.undertow.server.protocol.framed.AbstractFramedChannel.close(AbstractFramedChannel.java:789)
	at org.xnio.IoUtils.safeClose(IoUtils.java:134)
	at io.undertow.protocols.http2.Http2Channel.sendGoAway(Http2Channel.java:824)
	at io.undertow.protocols.http2.Http2Channel.sendGoAway(Http2Channel.java:801)
	at io.undertow.client.http2.Http2ClientConnection.close(Http2ClientConnection.java:313)
	at org.xnio.IoUtils.safeClose(IoUtils.java:134)
	at io.undertow.server.handlers.proxy.ProxyHandler$IoExceptionHandler.handleException(ProxyHandler.java:772)
	at org.xnio.ChannelListeners.invokeChannelExceptionHandler(ChannelListeners.java:126)
	at io.undertow.util.Transfer$TransferListener.handleEvent(Transfer.java:218)
	at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
	at io.undertow.server.protocol.framed.AbstractFramedStreamSinkChannel$1.run(AbstractFramedStreamSinkChannel.java:214)
	at io.undertow.server.protocol.framed.AbstractFramedChannel$3.run(AbstractFramedChannel.java:230)
	at org.xnio.nio.WorkerThread.safeRun(WorkerThread.java:582)
	at org.xnio.nio.WorkerThread.run(WorkerThread.java:466)

08:30:46,825 DEBUG (XNIO-1 I/O-6) [io.undertow.request.io] <AbstractFramedChannel.java:813> Marking reads broken on channel Http2Channel peer /127.0.0.1:63877 local 0.0.0.0/0.0.0.0:8888[ No Receiver [] -- [] -- []]: java.nio.channels.ClosedChannelException
	at io.undertow.server.protocol.framed.AbstractFramedChannel.markReadsBroken(AbstractFramedChannel.java:813)
	at io.undertow.server.protocol.framed.AbstractFramedChannel.receive(AbstractFramedChannel.java:470)
	at io.undertow.server.protocol.http2.Http2ReceiveListener.handleEvent(Http2ReceiveListener.java:109)
	at io.undertow.server.protocol.http2.Http2ReceiveListener.handleEvent(Http2ReceiveListener.java:60)
	at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
	at io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:921)
	at io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:902)
	at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
	at org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:66)
	at io.undertow.protocols.ssl.SslConduit$SslReadReadyHandler.readReady(SslConduit.java:1145)
	at io.undertow.protocols.ssl.SslConduit$1.run(SslConduit.java:168)
	at org.xnio.nio.WorkerThread.safeRun(WorkerThread.java:582)
	at org.xnio.nio.WorkerThread.run(WorkerThread.java:466)


@frapex frapex changed the title UNDERTOW-1204 mod_cluster proxy: set default value of cacheConnection… UNDERTOW-1204 mod_cluster proxy: set default value of cacheConnections (smax) to 1 Oct 23, 2017
@stuartwdouglas stuartwdouglas merged commit 6b262af into undertow-io:master Oct 24, 2017
@frapex frapex deleted the mod_cluster-cacheconnections branch October 26, 2017 06:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants