-
Bug
-
Resolution: Won't Do
-
Major
-
1.4.20.Final
-
None
The ProxyConnectionPool closes a connection before it reaches its ttl. This causes performance issues and unnecessarily consumes cpu, memory and network resources.
In an Undertow setup with 1 IO thread, 2 cached connections and mod_cluster backend ttl set to 10s, Apache HTTP server benchmarking tool load tests reveal:
- 1 connection: all good, no connections closed
- 2 concurrent connections: all good, no connections closed
- 3 or more concurrent connections: connections closed before their ttl is reached (state TIME_WAIT)
I pinpointed the code responsible for this:
ProxyConnectionPool.java
final int cachedConnectionCount = hostData.availableConnections.size(); if (cachedConnectionCount >= maxCachedConnections) { // Close the longest idle connection instead of the current one final ConnectionHolder holder = hostData.availableConnections.poll(); if (holder != null) { IoUtils.safeClose(holder.clientConnection); } }
The issue can be solved either by removing the code, or by putting it in an if statement that checks for ttl == 0. But that depends on the interpretation of ttl.
So does a ttl of 0s mean never expire, or expire immediately? Please let me know.
- is related to
-
UNDERTOW-1222 modcluster Node getMaxCachedConnections should return maxConnections
- Resolved