
Ask HN: What are the best practices for opening a single outbound connection? - millisecond
In a world where most systems are architected to redundantly handle tons of inbound connections sometimes you need to start a single long-lived highly available outbound one.<p>For inbound, it&#x27;s pretty easy, run redundant load balancing processes&#x2F;servers in front of redundant web front-ends.<p>When you need to open a single outbound connection, i.e. WebSocket to a remote service, how do you architect it on the standard cloud platforms to always have a single one open?  Need to both catch closes on the remote side and re-open and failures of the code &#x2F; instance &#x2F; hardware on the listening side.<p>Thinking something about locking a DB row or using atomic DB operations to claim the resource every N seconds and have a cluster of instances all contending for the resource, but feel like there must be a better way.
======
ahazred8ta
There are tcp-tunnel solutions that use redundant sessions, sometimes even
replicated proxies. This is one of them but YMMV.
[http://blog.ine.com/2008/11/06/ipsec-vpn-high-
availability-w...](http://blog.ine.com/2008/11/06/ipsec-vpn-high-availability-
with-hsrp/)

------
mrits
To be highly available the services certainly need to be aware of the status
of the connection. It seems like a normal election leader algorithm would
handle this just find.

