We\'re using haproxy in front of a netty-3.6-run backend. We are handling a huge number of connections, some of which can be longstanding.
Now the problem is that when h
Note : As per my understanding, You don't have to worry about Connection Reset Exception's, unless you've a Connection Pooling at your end with Keep-Alive Connections.
I faced a similar issue with lots of Connection Reset (RST) (It used to be 5-20times in a window of 10seconds, based on load) while using HAProxy for our services.
This is how I fixed it.
We had a system where connections are always kept-alive (keep-alive is always true at HTTP connection level. i.e., Once a connection is established, we reuse this connection from HTTP Connection pool for subsequent calls instead of creating new ones.)
Now, As per my debugging in Code and TCP Dump I found RST's were thrown from HAProxy in below scenario's
When HAProxy's timeout client or timeout server had reached, on an Idle Connection.
This configuration was set as 60seconds for us. Since we have a pool of connections, when the load on server decreases it would result in some of these connections not getting used for a minute.
So these connection's were then closed by HAProxy using a RST Signal.
When HAProxy's option prefer-last-server was not set.
As per the Docs:
The real use is for keep-alive connections sent to servers. When this option is used, haproxy will try to reuse the same connection that is attached to the server instead of rebalancing to another server, causing a close of the connection.
Since this was not set, everytime a connection was re-used from the pool, HAProxy used to Close this connection using RST Signal and create a new one to a different server (As our Load Balancer was set to round-robin). This was messing up and rendering the entire Connection Pooling useless.
So the Configuration that worked Fine:
With these configurations, we could
Hope this helps!!